Bird
0
0

Find the error in this C code:

medium📝 Debug Q14 of 15
C - Basics and Execution Environment
Find the error in this C code:
#include <stdio.h>
int main() {
    printf("Welcome to C programming")
    return 0;
}
Amain function should return void
BWrong header file included
CMissing semicolon after printf statement
Dprintf syntax is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of printf line

    The printf statement must end with a semicolon.
  2. Step 2: Identify missing semicolon

    Here, the semicolon after printf(...) is missing causing a syntax error.
  3. Final Answer:

    Missing semicolon after printf statement -> Option C
  4. Quick Check:

    Semicolon missing after printf [OK]
Quick Trick: Look for missing semicolons after statements [OK]
Common Mistakes:
  • Thinking header file is wrong
  • Assuming main returns void
  • Believing printf syntax is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes