adplus-dvertising
frame-decoration

Question

What is the output of this C code?
#include <stdio.h>
    int main()
    {
        int a = 1, b = 2;
        a += b -= a;
        printf("%d %d", a, b);
    }

a.

1 1

b.

1 2

c.

2 1

d.

2 2

Answer: (c).2 1

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this C code? #include <stdio.h> int main() { int a = 1, b = 2; a += b -= a; printf("%d %d", a, b); }

Similar Questions

Discover Related MCQs

Q. Which of the following is an invalid assignment operator?

Q. For initialization a = 2, c = 1 the value of a and c after this code will be

c = (c) ? a = 0 : 2;

Q. What will be the data type of the expression

(a < 50) ? var1 : var2;

provided a = int, var1 = double, var2 = float

Q. Which expression has to be present in the following?

exp1 ? exp2 : exp3;

Q. Value of c after the following expression (initialization a = 1, b = 2, c = 1):

c += (-c) ? a : b;

Q. Comment on the following expression?

c = (n) ? a : b; can be rewritten as

Q. In expression i = g() + f(), first function called depends on

Q. Which of the following operators has an associativity from Right to Left?

Q. Which operators of the following have same precedence?

P. "!=", Q. "+=", R. "&lt;&lt;="

Q. Comment on the following statement?

n = 1;
printf("%d, %dn", 3*n, n++);

Q. Which of the following option is the correct representation of the following code?

e = a * b + c / d * f;

Q. What care must be taken during swapping 2 numbers?

b = (b / a);
a = a * b;
b = a / b;

Q. Which of the following is the correct order of evaluation for the given expression?

a = w % x / y * z;

Q. Which function in the following expression will be called first?

a = func3(6) - func2(4, 5) / func1(1, 2, 3);

Q. Which of the following operator has the highest precedence in the following?

Q. Which of the following is a ternary operator?

Q. Which of the following are unary operators?

Q. Where in C the order of precedence of operators do not exist?

Q. Associativity of an operator are:

Q. Which of the following method are accepted for assignment?