It's evaluated as ((3 + (2 * 3)) + 2), not ((3 + 2) * (3 + 2)). If you don't wrap your macro arguments in parentheses, you may not get the evaluation order you wanted.

Wow thanks alot much appreciated, hey do you have any further detail into this, like do you know why it is evaluated in that way???? If not its kl you've helped out alot so far (Y)

It's evaluated that way because of the mathematical order of operations.

Look again.

//with this macro
#define SQUARED(x) (x*x)
//this line:
int i = SQUARED(3 + 2)
//literally becomes this
int i = [B]( 3 + 2 * 3 + 2)[/B];
//order of operations says multiplication occurs before addition
int i = ( 3 + [B]6[/B] + 2);
//remaining addition occurs from left to right
int i = ( [B]9[/B] + 2);
int i = ( [B]11[/B] );

You MUST watch your parentheses when defining macros.

Yeah I kinda figured from before that If I place the expression within parantheses then it comes out the way I expected it I just didnt understand why it came out different without the parantheses.

Actually, it's rather remarkable that the code you posted should work at all. You may have thought that you wrote

#define SQUARED(x) (x * x)

but what you actually wrote is

#define SQUARED(x) {x * x}

so that your statement

int i = SQUARED(3 + 2);

should expand to

int i = {3 + 2 * 3 + 2};

As it happens, however, C++ allows initializers to be enclosed in curly braces. This usage is important for initializing arrays and structures. So the expansion of your example is equivalent to

Hi everyone!, I had this confusion about the the Bucket Sort Algorithm.
I just wanna know why mostly bucket sort use the range of element in between 0 and 1 ...

Good day community,
I have completed vb.net program (a school timetabling program) and I am in the process to create a website. At the moment word -press on wamp server ...