C Interview Questions and Answers

 

Why doesnt that code work?

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 .

Posted by:Richards