ProgrammingHardGATE CS · TCS NQT
What is printed?
What is printed?
#include <stdio.h>
int main(void) {
int m[2][3] = {{1, 2, 3}, {4, 5, 6}};
int (*p)[3] = m;
p++;
printf("%d", **p);
}- A. 4
- B. 1
- C. 2
- D. 5
Correct answer: A. 4
p++ moves the row pointer to m[1], and **p is the first element of that row, which is 4.
More C Programming questions
- What is printed? c #include <stdio.h> int main(void) { unsigned x = 0xA8; printf("%u", x & (0u - x)); }
- What is printed? c #include <stdio.h> int main(void) { unsigned short p = 1; for (int i = 0; i < 20; i++) p = 2; printf("%d", p); }
- What is printed? c #include <stdio.h> int main(void) { unsigned x = 0xFFFFFFFEu; x += 3; printf("%u", x); }
- How many values m in 0..15 have bit 2 set and bit 0 clear? Compute with this program. c #include <stdio.h> int main(void) { int c = 0; for…
- What is printed? c #include <stdio.h> int main(void) { printf("%d", -1 < (unsigned)0); }
- What is printed? c #include <stdio.h> #include <stdlib.h> int cmp(const void a, const void b) { const int x = a, y = b; if (x[1] != y[1])…