#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
Why we use conio h in c?
What are the advantages and disadvantages of c language?
What is the c value paradox and how is it explained?
Why we write conio h in c?
Dont ansi function prototypes render lint obsolete?
What is the difference between if else and switchstatement
What language is lisp written in?
How can I get the current date or time of day in a c program?
Explain what is the difference between far and near ?
What is meant by initialization and how we initialize a variable?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
any "C" function by default returns an a) int value b) float value c) char value d) a & b
What is return type in c?
What is the Purpose of 'extern' keyword in a function declaration?
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM