Bird
0
0

Why is the return type of main() usually int in C programs?

hard📝 Conceptual Q10 of 15
C - Basics and Execution Environment
Why is the return type of main() usually int in C programs?
ATo print output on the screen
BTo indicate program exit status to the operating system
CTo declare global variables
DTo include header files
Step-by-Step Solution
Solution:
  1. Step 1: Understand main() return type purpose

    int return type allows main() to return an exit status code to the OS.
  2. Step 2: Eliminate incorrect options

    Printing output, declaring variables, and including headers are unrelated to return type.
  3. Final Answer:

    To indicate program exit status to the operating system -> Option B
  4. Quick Check:

    int main() return = exit status [OK]
Quick Trick: int main() returns exit code to OS [OK]
Common Mistakes:
  • Thinking return type prints output
  • Confusing return type with variable declaration

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes