ProgrammingVery hardProduct company OA

What is printed?

What is printed?
#line 100
int a = __LINE__;
int b = __LINE__;
printf("%d %d", a, b);
  1. A. 100 101
  2. B. 1 2
  3. C. 100 100
  4. 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

Exams that ask this topic