To read an int using scanf we use:
scanf(\"%d\", &i);
What if i is a long not int??
Each conversion specifier expects its corresponding argument to be of a specific type; if the argument's type does not match the expected type, then the behavior is undefined. If you want to read into a long with scanf(), you need to use the %ld conversion specifier:
long i;
scanf("%ld", &i);
Check the online draft C standard (.pdf file), section 7.19.6.2, paragraph 11 for a complete listing of size modifiers and expected types.