edited by
5,881 views
8 votes
8 votes

Consider the following statements

#define hypotenuse (a, b) sqrt (a*a+b*b);

The macro call hypotenuse(a+2,b+3);

  1. Finds the hypotenuse of a triangle with sides $a+2$ and $b+3$
  2. Finds the square root of $(a+2)^2$ and $(b+3)^2$
  3. Is invalid
  4. Find the square root of $3 *a+4*b+5$
edited by

2 Answers

Best answer
16 votes
16 votes

#define hypotenuse (a, b) sqrt (a*a+b*b);

hypotenuse(a+2,b+3)

after macro expansion it will become sqrt(a+2*a+2+b+3*b+3)

Now after evaluating you will get D.

selected by
Answer:

Related questions

9 votes
9 votes
5 answers
1
go_editor asked Jun 21, 2016
6,119 views
The for loopfor (i=0; i<10; ++i) printf("%d", i&1);prints0101010101011111111100000000001111111111
10 votes
10 votes
4 answers
2
go_editor asked Jun 21, 2016
9,377 views
The output of the following program ismain() { static int x[] = {1,2,3,4,5,6,7,8} int i; for (i=2; i<6; ++i) x[x[i]]=x[i]; for (i=0; i<8; ++i) printf("%d", x[i]); }1 2 3 ...
8 votes
8 votes
2 answers
3
go_editor asked Jun 21, 2016
7,630 views
Consider the following program fragmenti=6720; j=4; while (i%j)==0 { i=i/j; j=j+1; }On termination j will have the value4896720
7 votes
7 votes
3 answers
4
go_editor asked Jun 21, 2016
6,607 views
The following programmain() { inc(); inc(); inc(); } inc() { static int x; printf("%d", ++x); }prints 012prints 123prints 3 consecutive, but unpredictable numbersprints 1...