Basic and Advance C Question:
Download Questions PDF

Why doesnt that code work?

Answer:

Why doesn't the code
short int s;
scanf("%d", &s);

work?

When converting %d, scanf expects a pointer to an int. To convert to a short int, use %hd .

Download C Programming Interview Questions And Answers PDF

Previous QuestionNext Question
How can I read data from data files with particular formats?Why doesnt this code work?