To read an int using scanf we use:
int
scanf(\"%d\", &i);
What if i is a long not int??
i
long
scanf("%ld", &i);
You can also use "%Ld" for a long long (and depending on your compiler, sometimes also "%lld").
"%Ld"
long long
"%lld"
Take a look at the Conversions section of the scanf man page for more. (Just Google it if your system doesn't have manpages).