how to swap two nubers by using a function with pointers?
Answer Posted / 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 View All Answers
Compare and contrast compilers from interpreters.
What is a program flowchart?
How do c compilers work?
When can a far pointer be used?
What is volatile, register definition in C
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?
What is calloc()?
Can one function call another?
Explain the difference between strcpy() and memcpy() function?
What is sizeof array in c?
What is a null pointer in c?
What Is The Difference Between Null And Void Pointer?
How do you define a string?
What is difference between scanf and gets?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f