Interview Question
Country: United States
is not writing a return statement at the end a reason for the error because the main function is defined as "int" ?
no..it should not be a reason..even after writing return statement at the end output will be some garbage value.
since you are using %d specifier,you are trying to store 4 byte integer in 2 byte short integer.so output will be some garbage value.
- Abhishek July 03, 2012to accept short int variable using scanf(),use %hd specifier.