ProgrammingHardProduct-company MCQ pattern
Which of a, b, c, d are pointers?
Which of a, b, c, d are pointers?
#define IPTR int* typedef int* IPT; IPTR a, b; IPT c, d;
- A. a and c only
- B. a, c and d
- C. c and d only
- D. All four
Correct answer: B. a, c and d
The macro is plain text: IPTR a, b; becomes int* a, b; and the * binds only to a, so b is an int. A typedef names a real type, so IPT c, d; makes both c and d pointers.
More C Programming questions
- What is printed? c #define DEBUG 0 ... #ifdef DEBUG printf("on "); #endif #if DEBUG printf("trace"); #endif
- In C, with int i = 1, a[5];, which statement has undefined behaviour?
- Compiled as C with 4-byte int, what is printed? c printf("%zu %zu", sizeof('A'), sizeof(char));
- What is printed? c int x = 1; { int x = 2; { x = 3; } printf("%d ", x); } printf("%d", x);
- With 4-byte int, what is printed? c int a[5]; printf("%td %td", (char )(a + 1) - (char )a, (char )(&a + 1) - (char )a);
- What is printed? c printf("%d", 010 + 0x10 + 10);