A

Admin • 833.24K Points
Coach

Q. What is the difference between the following 2 C codes?

Code:
#include <stdio.h> //Program 1
int main()
{
int d, a = 1, b = 2;
d = a++ + ++b;
printf("%d %d %d", d, a, b);
}

#include <stdio.h> //Program 2
int main()
{
int d, a = 1, b = 2;
d = a++ +++b;
printf("%d %d %d", d, a, b);
}
  • (A) No difference as space doesn’t make any difference, values of a, b, d are same in both the case
  • (B) Space does make a difference, values of a, b, d are different
  • (C) Program 1 has syntax error, program 2 is not
  • (D) Program 2 has syntax error, program 1 is not
  • Correct Answer - Option(D)
  • Views: 35
  • Filed under category C Programming
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.