title: Error with scanf() by compiling a C program in Sublime Text 2
body: <p>I finally managed to configure the compiler for <code>C</code> in Sublime Text 2. In a <code>int main()</code> function, there is no problem with <code>printf()</code>, but there is a problem with the compiler using <code>scanf()</code>. It does not allow keyboard input and jump instruction.</p>
  
  <p>There is the build code for C:</p>
  
  <pre><code>{
      "cmd": ["gcc", "-Wall", "-ansi", "-pedantic-errors", "$file_name", "-o", "${file_base_name}.exe", "&amp;&amp;", "${file_base_name}.exe"],
      "selector": "source.c",
      "shell": true,
      "working_dir": "$file_path"
  }
  </code></pre>
  
  <p>There is the C code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
  
      int num, cube;
  
      printf("Enter a number for know the cube: ");
      scanf("%d", &amp;num);
  
      cube = num * num * num;
  
      printf("\nThe cube %d is %d.\n\n", num, cube);
  
      return 0;
  }
  </code></pre>
  
  <p>Screenshot below:</p>
  
  <p><img src="https://i.stack.imgur.com/NuQm1.png" alt="error in scanf()"></p>
  
  <p><a href="http://sia1.subirimagenes.net/img/2015/01/16/150116021527262835.png" rel="nofollow noreferrer">error in scanf()</a></p>
  
  <p><a href="http://sia1.subirimagenes.net/img/2015/01/16/150116022218603635.png" rel="nofollow noreferrer">c build</a></p>