25 Feb 2015

Basic level c practice preprocessor set 1

1.     
      #define prod(a,b) a*b
main()
{
            int x=3,y=4;
            printf("%d",prod(x+2,y-1));
}
Answer:
10
Explanation:
            The macro expands and evaluates to as:
            x+2*y-1 => x+(2*y)-1 => 10




No comments:

Post a Comment