Introduction To Programming

Why programs ? Programming is nothing but making the computers think the same way a human thinks. Programs are made for obtaining a specific solution which can even be solved by humans which when solved by us may consume time..

Sunday, February 7, 2010

10

#include < iostream.h >
main()
{
int a=1,b=2;
a=a,b;
b=(a,b);
cout < < a < < b;
}
OUTPUT

1    2
How?

as said in last post 'a=a,b;' is equal to
a=a;
b;
so a=1.
in next line i.e 'b=(a,b)':
in this expression we use brackets(brackets has 'right to left associativiy' i.e
operation will be in this direction <-- )
so b=b will be assigned.i.e.,
b=b;
a;
so b=2.