Bird
0
0

Identify the error in the following C program:

medium📝 Debug Q14 of 15
C - Basics and Execution Environment
Identify the error in the following C program:
#include <stdio.h>

int main() {
    printf("Welcome to C programming!");
}
AMissing return statement in main function
BMissing semicolon after printf statement
CIncorrect header file included
DNo error, program is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of printf statement

    The printf line ends with a semicolon, so no syntax error there.
  2. Step 2: Check main function return

    The main function is declared to return int but lacks a return statement, which can cause a warning or error depending on compiler settings.
  3. Final Answer:

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

    main() must return int value [OK]
Quick Trick: Always include return 0; in main() [OK]
Common Mistakes:
  • Assuming missing semicolon error
  • Ignoring missing return in main
  • Thinking header file is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes