asked 166k views
3 votes
What would be the output of the following programs } int a = 300, b, c; if (a >= 400) b = 300; c = 200; printf ("\\%d %d", b, c);​

asked
User Alexblum
by
8.2k points

1 Answer

2 votes

The output of the program would be:

0 200

This is because the variable a has a value of '300', which is not greater than or equal to '400', so the statement b = 300 is not executed. Therefore, the value of b remains uninitialized and contains an unspecified value. The statement c = 200 is executed, so the variable c has a value of 200.

When the printf statement is executed, the value of b is printed, which is uninitialized and therefore has an unspecified value (in this case, 0), followed by the value of c, which is '200'. Therefore, the output is '0 200'.


\:

answered
User Ctorx
by
7.7k points