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

what is the difference between exit() and _exit() functions?

2 Answers  


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

0 Answers   Google,


What is the difference between test design and test case design?

0 Answers  


1 1 12 21 123 321 12344231 how i creat it with for loop??

1 Answers  


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

0 Answers  


#include<stdio.h> #include<conio.h> int main() { int a[4][4]={{5,7,5,9}, {4,6,3,1}, {2,9,0,6}}; int *p; int (*q)[4]; p=(int*)a; q=a; printf("\n%u%u",p,q); p++; q++; printf("\n%u%u",p,q); getch(); return 0; } what is the meaning of this program?

2 Answers  


What are different types of pointers?

0 Answers  


int main() { int i=-1,j=-1;k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d%d%d%d%d",i,j,k,l,m); }

3 Answers   HCL,


What are the advantages and disadvantages of a heap?

0 Answers  


What is strcpy() function?

0 Answers  


What 'lex' does?

0 Answers   Tech Mahindra,


Explain how can I read and write comma-delimited text?

0 Answers  


Categories