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:
bool flag = 1;
char letter = "B";
int count = 10;
Achar should use single quotes for characters
Bbool cannot be assigned 1
Cint cannot be assigned 10
DNo errors, code is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check bool assignment

    Assigning 1 to bool is allowed since 1 means true in C.
  2. Step 2: Check char assignment

    Characters must be in single quotes ('B'), not double quotes ("B") which are for strings.
  3. Final Answer:

    char should use single quotes for characters -> Option A
  4. Quick Check:

    char uses single quotes [OK]
Quick Trick: Use single quotes for char, double for strings [OK]
Common Mistakes:
  • Using double quotes for char
  • Thinking bool can't be 1 or 0
  • Confusing int assignments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes