Bird
0
0

Which of the following is the correct syntax to read three integers a, b, c in C?

easy📝 Syntax Q12 of 15
C - Input and Output
Which of the following is the correct syntax to read three integers a, b, c in C?
Ascanf("%d %d %d", &a, &b, &c);
Bscanf("%d %d %d", a, b, c);
Cscanf("%d, %d, %d", &a, &b, &c);
Dscanf("%d %d %d", *a, *b, *c);
Step-by-Step Solution
Solution:
  1. Step 1: Check scanf format string and arguments

    The format string should have three %d separated by spaces, and variables must be passed by address using &.
  2. Step 2: Identify correct option

    scanf("%d %d %d", &a, &b, &c); uses correct format string and & before variables, so it is correct.
  3. Final Answer:

    scanf("%d %d %d", &a, &b, &c); -> Option A
  4. Quick Check:

    Use & with variables in scanf [OK]
Quick Trick: Always use & before variables in scanf [OK]
Common Mistakes:
  • Omitting & before variables
  • Using commas inside format string incorrectly
  • Using pointers incorrectly with *

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes