Sunday, August 23, 2009

different ideas

#include
main()
{
char str[]="%d";
int i=10;
printf(str,i);
getch();
}


output:

10

please check it...


swapping in preprocessor method

#include
#define swapp(a,b) t=a;a=b;b=t;
main()
{
char str[]="%d";
int a=10,t,b=9;
swapp(a,b);
printf("%d%d",a,b);
getch();
}




a=9 b=10

No comments:

Post a Comment