title: Scan an int after a letter
body: <p>I'm building a program and I encounter a small problem and I can't find a solution to it.
  So my goal is to scan a certain letter and when that happens, I just get the number in front of it. Here's the code:</p>
  <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt;
  
  int main(){
  
      int pag = 1;
      char *op = malloc(sizeof(char));
      char* opt = malloc(sizeof(char));
              
      printf(&quot;P      -&gt; Next\n&quot;);
      printf(&quot;A      -&gt; Back\n&quot;);
      printf(&quot;S &lt;N&gt;  -&gt; Jump to N\n&quot;);
      printf(&quot;B      -&gt; Sair\n&quot;);
      printf(&quot;\n&quot;);
  
      printf(&quot;Insert option: &quot;);
      fgets(op, 4, stdin);
          
      if(op[0] == 'S'){
          
          opt = strsep(&amp;op, &quot; &quot;);
              
          pag = atoi(op);     
      }
  
      printf(&quot;Page: %d\n&quot;, pag);
  
      free(op);
      free(opt);
  }
  </code></pre>
  <p>When I execute the program and I chose the option &quot;S 5&quot; for example, my goal is to get the &quot;5&quot;. The problem is when I chose a number with more than 2 digits, for example, &quot;S 12&quot; gives me the number &quot;1&quot;, not the number 12, I don't know if the problem is with the memory allocation or something else.</p>