#include<stdio.h>
#define SWAP(num1,num2,temp) (temp=num1,num1=num2,num2=temp)
main()
{
int tempi,a=10,b=20;
float tempf,c=10.7,d=20.2;
SWAP(a,b,tempi);
printf(" a is %d b is %d",a,b);
SWAP(c,d,tempf);
printf(" c is %.2f d is %.2f ",c,d);
// .2 implies displaying two digits after decimal
}
#define SWAP(num1,num2,temp) (temp=num1,num1=num2,num2=temp)
main()
{
int tempi,a=10,b=20;
float tempf,c=10.7,d=20.2;
SWAP(a,b,tempi);
printf(" a is %d b is %d",a,b);
SWAP(c,d,tempf);
printf(" c is %.2f d is %.2f ",c,d);
// .2 implies displaying two digits after decimal
}
No comments:
Post a Comment