C - Basics and Execution EnvironmentWhy is the return type of main() usually int in C programs?ATo print output on the screenBTo return an exit status to the operating systemCTo declare main as a void functionDTo allocate memory for the programCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the role of main's return valueThe return value of main is used to indicate success or failure to the operating system.Step 2: Match the purpose with the correct optionReturning an int allows the program to send an exit status code back to the OS.Final Answer:To return an exit status to the operating system -> Option BQuick Check:Main returns exit status = int return type [OK]Quick Trick: int main returns status code to OS after program ends [OK]Common Mistakes:Thinking main prints outputConfusing return type with voidAssuming return allocates memory
Master "Basics and Execution Environment" in C9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Quizzes C Basics and Execution Environment - Why C is widely used - Quiz 14medium Input and Output - Multiple input and output - Quiz 2easy Loop Control Statements - Return inside loops - Quiz 2easy Loops - Do–while loop - Quiz 4medium Operators and Expressions - Logical operators - Quiz 1easy Variables and Data Types - Scope of variables - Quiz 8hard Variables and Data Types - Constants and literals - Quiz 8hard Variables and Data Types - Type modifiers - Quiz 1easy Variables and Data Types - Variable declaration and initialization - Quiz 2easy Variables and Data Types - Storage size overview - Quiz 13medium