by David Hamrick |
||
| Home Links Starting Out Variables Projects
|
Scanf Scanf is a very useful function that we find in the stdio library that we use for printf. Scanf may seem a little complitcated at first but once you get the hang of it its very easy. Scanf is basically a very easy way to collect input from the keyboard. Whatever you type and then press enter will be put into the variable you tell it to. For example int a; That program would collect whatever input you put in to the console. Whenever you want want to collect a number you use %d, but thats not the case for all things. %d - int That is the basic way to use to scanf. Here is an example of how to use it. #include <stdio.h> |