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);
}

Answers were Sorted based on User's Feedback



#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / 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

#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / ashish rajvanshi

My dear frnds its a simple question
here the code of macro inserted in the program at the time of preprocessing and then the calculation will performed.
and then it will be calculated.

void main()
{
int i,j, temp;
i=5;
j=10;
temp=0;
if(i>j)
temp=a;
a=b;
b=temp;
printf("%d %d %d" , i , j , temp);
}

for further detail contect at(ashish.raj.mrt@gmail.com)

Is This Answer Correct ?    3 Yes 1 No

#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / vinodhini

The output will be
5100

Is This Answer Correct ?    2 Yes 0 No

#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / ashishrajvanshi01

On compiling i got ans 10, 0, 0. I did not understand the concept. Please expalin this to me.

Is This Answer Correct ?    5 Yes 4 No

#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / harish

it enters into swap function only when i>j.

but i contains 5 and j contains 10.

can u plz explain this

Is This Answer Correct ?    0 Yes 0 No

#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / abhijeet

my frnd, C is dumb compiler. It doesn't know what actually
we mean.
Here, in this program, we have defined 1 macro. Ok
this macro wil be inserted and expanded into code.
this gives the unpredicted result. U try and find out what i
mean to say.

Is This Answer Correct ?    1 Yes 1 No

#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / shweta

#include<stdio.h>
#define fun(a) #a#a#a
void main(){
printf("%u",fun(5+9));
}

Is This Answer Correct ?    1 Yes 1 No

#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / kumaravel

chance of providing answer is not possible. empty screen become view.

Is This Answer Correct ?    0 Yes 0 No

#include<stdio.h> #include<conio.h> # define swap(a,b) temp=a; a=b; b=temp; void mai..

Answer / manish soni tagore collage jai

my dear frd....
here some hapen.
#define swap(a,b) temp=a;a=b;b=temp;----------(1)
is was as function of swap two no;(but it is differnt frm
funtion.)
so
at i>j;
enter swap(i,j);
so jump at eq(n) ---(1) and call swap function'
and


temp=5;


i=10;
j=0;

you see three variable.
but it printf i,j to convert swap.
bcoz it have two arguments.
and print temp=0;
becoz temp have 0;

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More C Interview Questions

write a programme to convert temperature from farenheit to celcius?

4 Answers   IBM,


what is c programing

11 Answers   Wipro,


Sir,please help me out with the output of this programme:- #include<stdio.h> #include<conio.h> void main() { int a=18,b=12,i; for(i=a<b?a:b;a%i||b%i;i--); printf("%d %d",i); }

4 Answers  


what is diference between return 0 and return NULL??

3 Answers  


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

0 Answers   IBM,


Explain what is the difference between functions getch() and getche()?

0 Answers  


What is the output of the below program and how it is? void main() { static int var=5; printf("%d",var--); if(var) main(); }

8 Answers   MindFire, TCS, Tech Mahindra,


What is an endless loop?

0 Answers  


What is the difference between volatile and const volatile?

0 Answers  


What is a macro?

0 Answers  


void main() { int x=25,y=32; clrscr(); x=x++ + y++; y=++x + ++y; printf("%d%d",x,y); }

5 Answers  


write a program to generate 1st n fibonacci prime number

12 Answers  


Categories