[LCP]macro execution

Srinath Thiruvengadam rangar20 at eth.net
Sat Aug 4 01:15:04 UTC 2001


please consider this macro,
 
*********************************
#define sqr(x) (x*x)

void main()
{
  int i=5;
  int j;
 
  j=sqr(++i);
  printf("%d",j);
}
*********************************

it prints 49. it should execute like this      ( ++i * ++i )
now, when this goes on to stack , shouldnt it go like this
 
|7 |
|* |
|6 |
 
the result should be only 42!
 

Thanks & Regards, 
Srinath Thiruvengadam

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20010804/95be204b/attachment.htm 


More information about the linuxCprogramming mailing list