how to swap two nubers by using a function with pointers?



how to swap two nubers by using a function with pointers?..

Answer / reshma

void swap(int *a, int *b)
{
int tmp;
tmp=*a;
*a=*b;
*b=tmp;
}

or

void swap(int *a, int *b)
{
*a=*a^*b;
*b=*a^*b;
*a=*a^*b;

}

Is This Answer Correct ?    10 Yes 1 No

Post New Answer

More C Interview Questions

Explain argument and its types.

0 Answers  


Program to simulate second clock

2 Answers  


How many levels deep can include files be nested?

0 Answers  


write the program to find multiplication of 2-D matrix??????????

1 Answers  


What are the applications of c language?

0 Answers  






How many identifiers are there in c?

0 Answers  


Why is #define used?

0 Answers  


What is wrong with this declaration?

0 Answers  


What is volatile

2 Answers  


What is sizeof c?

0 Answers  


what is differnence b/w macro & functions

1 Answers  


Which one would you prefer - a macro or a function?

0 Answers  


Categories