Machine-translated by Google. Questions are authored in English.
Top

Discussion

What will be the output of the program?

#include <stdio.h>
#define FUN(i, j) i##j

int main()
{
    int va1=10;
    int va12=20;
    printf("%d\n", FUN(va1, 2));
    return 0;
}

 

  • A.10
  • B.20
  • C.1020
  • D.12

Answer: B

Correct answer: 20

## pastes its operands into a single token, so FUN(va1, 2) becomes va12 - the name of the second variable. The printf therefore prints 20.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.