ProgrammingModerate
int a, b, c; a = b = c = 5; printf("%d", a + b + c); What is printed?
- A. 15
- B. 5
- C. 10
- D. 3
Correct answer: A. 15
Chained assignment gives each variable the value 5, and their sum is 15.
More C Programming questions
- On a platform with 4-byte int, int i = 5; printf("%zu %d", sizeof(i++), i); What is printed?
- int n = 3; int p = &n; printf("%d", p p + p); What is printed?
- int m[2][2] = {{1, 2}, {3, 4}}; int p = &m[0][0]; printf("%d", p[2] p[1]); What is printed?
- unsigned char c = 255; c++; printf("%d", c); What is printed?
- int i = 0; printf("%d %d", i++, i); What does this code do?
- const char names[] = {"zero", "one", "two"}; printf("%c", names[2][1]); What is printed?