ProgrammingVery hardProduct company OA
What is printed?
What is printed?
#line 100
int a = __LINE__;
int b = __LINE__;
printf("%d %d", a, b);- A. 100 101
- B. 1 2
- C. 100 100
- D. 101 102
Correct answer: A. 100 101
#line 100 says that the next source line is line 100, so __LINE__ expands to 100 there and to 101 on the line after. '101 102' counts the directive itself as line 100.
More C Programming questions
- What is printed? c #define CAT(a, b) a##b printf("%d", CAT(1, 2) + CAT(0x, 1F));
- What is printed? c #define f(x) ((x) 2) int (f)(int x) { return x + 100; } int main(void) { printf("%d %d", f(1), (f)(1)); }
- What is printed? c if (strcmp("abc", "abc")) puts("same"); else puts("different");
- Assume ASCII. What is printed? c int x = 'A' + 1.5; printf("%c %d", x, x);
- Given int m[3][4];, why can m not be passed to a function declared void f(int p);?
- Assume C99 or later. What is printed? c void f(int n, int a[][n]) { printf("%zu", sizeof a[0] / sizeof a[0][0]); } int main(void) { int…