Bird
0
0

Identify the error in this C program:

medium📝 Debug Q6 of 15
C - Basics and Execution Environment
Identify the error in this C program:
#include <stdio.h>
int main() {
    printf("Hello");
}
AIncorrect printf syntax
BMissing semicolon after printf
CMissing return statement in main
DMissing main function
Step-by-Step Solution
Solution:
  1. Step 1: Check for syntax errors

    All syntax is correct: semicolon present, printf syntax correct, main function exists.
  2. Step 2: Check for missing return statement

    Standard C requires main to return int; missing return 0; is an error or warning.
  3. Final Answer:

    Missing return statement in main -> Option C
  4. Quick Check:

    main must return int with return statement [OK]
Quick Trick: Always end main with return 0; for success [OK]
Common Mistakes:
  • Omitting return statement
  • Assuming void main is valid
  • Ignoring compiler warnings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes