What is the output of the following C program? int main() { int x = 10; printf("%d", x); }

Options

  • B. 10
  • C. Garbage value
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. 10

Detailed Explanation

Answer: (B) 10

The variable x is declared as an integer and is initialized with the value 10.

The statement printf("%d", x); prints the integer value stored in x.

Therefore, the output is 10.