C and C++ programs and MySQL
Always thinking in engineering style...
Tuesday, August 4, 2009
swapping without third variable and single line
main()
{
int a=15,b=5;
clrscr();
a=(a+b)-(b=(a+b)-b);
printf("a=%d b= %d",a,b);
getch();
}
output: a=5 b=10
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment