Basic and Advance C Question:

Download Job Interview Questions and Answers PDF

Why doesnt long int work?

C Programming Interview Question
C Programming Interview Question

Answer:

Why doesn't
long int n = 123456;
printf("%dn", n);

work?

Whenever you print long ints you must use the l (lower case letter ``ell'') modifier in the printf format (e.g. %ld). printf can't know the types of the arguments which you've passed to it, so you must let it know by using the correct format specifiers.

Download C Programming Interview Questions And Answers PDF

Previous QuestionNext Question
Why doesnt the call scanf work?What is wrong with this code?