Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

#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


Please Help Members By Posting Answers For Below Questions

c program to compute AREA under integral

2336


Explain the array representation of a binary tree in C.

1166


what is the height of tree if leaf node is at level 3. please explain

2088


Is c language still used?

933


Create a simple code fragment that will swap the values of two variables num1 and num2.

1237


difference between Low, Middle, High Level languages in c ?

2024


What is a pointer value and address in c?

1057


What is c token?

1012


What is the difference between volatile and const volatile?

936


What is malloc and calloc?

1004


How many types of functions are there in c?

1064


What are the 32 keywords in c?

1042


What are two dimensional arrays alternatively called as?

1133


Explain the advantages and disadvantages of macros.

1035


What is an operator?

1019