A lot of new C programmers have trouble with scanf().
The main reason beginners have trouble is scanf works like a pointer so you have to point to what you are getting input for
<pre class="prettyprint lang-auto linenums:0">
printf("Enter a number:");
See, when we used scanf we first declared what the variables type was
"%d" for int ,"%f" for float ,"%e" for a scientific notation (1e10) ,"%c" for char , "%s" for strings.
Then in the second part we have to use & just like in a pointer to point to the variable instead of just getting its value.
Remember without & your program will likely crash.
For handling strings with whitespace (sentences) and in files use fgets.