title: Getting integer while using strtok() in string
body: <p>I'm new to C and need your help.
  I'm trying to get an integer from a string that has a number in it.
  I have with me a code I did but the only problem is when I'm assigning years as int i think I'm getting some sort of an address. Is there a way to get my char years into an in years?</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;stdlib.h&gt;
   #include &lt;string.h&gt;
  
   int main()
   {
     char sentence[]="trade_#_2009_#_invest_#_DEALING";
  
     char *word=strtok(sentence, "_#_");
     char *year=strtok(NULL,"_#_");   // assigning NULL for previousely where it left off
     char *definition=strtok(NULL,"_#_");
     char *synonyms=strtok(NULL,"_#_");
  
     printf("%s\n", word);
     printf("%s\n", year);
     printf("%s\n", definition);
     printf("%s\n", synonyms);
  
     return 0;
   }
  </code></pre>