This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes C / C++ and the fly likes Macros Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Macros" Watch "Macros" New topic


Ramesh Pramuditha Rathnayake
Ranch Hand

Joined: Oct 31, 2012
Posts: 169

This prints:
36, 4
25, 5

Why i is still 4 in first case..?

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37913
But my slightly different version produces 36, 6 and 25, 5. I suspect it is not strictly defined; I would suggest you will have to emulate the OP in this thread and go through the language specifications.

By the way: I thought you should always have () round the expressions in macros.
Ramesh Pramuditha Rathnayake
Ranch Hand

Joined: Oct 31, 2012
Posts: 169

Yes.. I know the importance to have () in macros. I didn't need to use it here..

I know that I've made the same mistake that I have done in my previous thread.. I know C is a real maze.

I understand that compiler is the reason for all of these stuff..!!
Don't get me started about those stupid light bulbs.
subject: Macros
Similar Threads
Post your favorite trick questions
Accurately detecting 64 bit Windows architecture
C2143 error and I can't find it
Java loops- linear/log time- calculation
C quiz questions