Bird
0
0

Identify the error in this C code snippet:

medium📝 Debug Q14 of 15
C - Variables and Data Types
Identify the error in this C code snippet:
int main() {
    int x;
    x = 10
    printf("%d", x);
    return 0;
}
AMissing semicolon after x = 10
BVariable x not declared
Cprintf syntax incorrect
DReturn statement missing
Step-by-Step Solution
Solution:
  1. Step 1: Check each line for syntax errors

    The line x = 10 is missing a semicolon at the end, which is required in C.
  2. Step 2: Verify other parts

    Variable x is declared, printf syntax is correct, and return statement is present.
  3. Final Answer:

    Missing semicolon after x = 10 -> Option A
  4. Quick Check:

    Every statement ends with ; in C [OK]
Quick Trick: Check for missing semicolons after assignments [OK]
Common Mistakes:
  • Forgetting semicolon after statements
  • Assuming variable declaration is missing
  • Misreading printf syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes