HP PLACEMENT PAPERS -------- Placement Paper - 2

Answer Posted / dharati

3 # define swap(a,b) temp=a; a=b; b=temp;
main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i > j)
swap( i, j );
printf( "%d %d %d", i, j, temp);
}
Ans: On compiling i got ans 10, 0, 0. I did not
understand the concept. Please
expalin this to me.
its because macro is expanded as

temp = i;
i = j;
j = temp;

the condition gets false as i < j and first statement i.e.
temp = a is not executed and remaining statements gets
executed and results in i = 10 and j = 0.

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

i want the sample placement paper of goldman sachs urgently. please send it to me

4154


What are the frequently asked questions for interview in capital iq company ?

1550


aptitude

913


Recently conducted Apptitude test

1609


why didn't get placed so far?

1419


What were the occupations of the people who lived within the Mauryan Empire?

830


email me previous question papers of bob bank for po exams

2249


Zero setting of sejong rottary press

1403


Do we have vacancy for HR RECRUITER ?

1578


What kind of Issues/bugs arise in ETL projects? I would like to know few issues (critical to somewhat bugs ) normally occur in ETL process especially when testing? Domains can be banking, retail or any.

1629


what is difference between uv and visible spectroscopy and how to differentiate the drug compounds in uv visible region

1833


If anybody knows the recruitment procedure of IOTL & POWER MECHANICAL. send me the placement papers if u hav... very urgent ...

4142


what is placement paper?

2365


Danlaw placement questions and answers

1596


what is the use of air in gc

1614