#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
What are c header files?
What are enums in c?
What are the types of pointers in c?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
What is calloc() function?
What is size of union in c?
about c language
What are qualifiers?
number of times a digit is present in a number
What is a c token and types of c tokens?
Explain is it better to bitshift a value than to multiply by 2?
What does emoji p mean?
State the difference between x3 and x[3].
Write a program in c to replace any vowel in a string with z?
Write a program to reverse a given number in c language?