#include<stdio.h>
#include<conio.h>
# define swap(a,b) temp=a; a=b; b=temp;
void main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i > j)
swap( i, j );
printf( "%d %d %d", i, j, temp);
}
Answer Posted / rohit751
Hi all...the main mistake in the program is using the semi
colons in the macro definition. Try this..
#include<stdio.h>
#include<conio.h>
# define swap(a,b) temp=a, a=b, b=temp;
void main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i < j)
swap( i, j );
printf( "%d %d %d", i, j, temp);
}
| Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
c program to compute AREA under integral
Explain the array representation of a binary tree in C.
what is the height of tree if leaf node is at level 3. please explain
Is c language still used?
Create a simple code fragment that will swap the values of two variables num1 and num2.
difference between Low, Middle, High Level languages in c ?
What is a pointer value and address in c?
What is c token?
What is the difference between volatile and const volatile?
What is malloc and calloc?
How many types of functions are there in c?
What are the 32 keywords in c?
What are two dimensional arrays alternatively called as?
Explain the advantages and disadvantages of macros.
What is an operator?