write a function which accept two numbers from main() and
interchange them using pointers?

Answer Posted / sarathi

#include<stdio.h>
main()
{
int *p,*q;
*p=10;
*q=20
void swap(int &p,int &q);
}
void swap(int *x,int *y);
{
int *tmp;
*tmp=*x;
*x=*y;
*y=*x;
printf("%d,%d",*x,*y);
}

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does p mean in physics?

577


how can I convert a string to a number?

590


Explain 'bit masking'?

645


Where local variables are stored in c?

553


How can I get back to the interactive keyboard if stdin is redirected?

663






What is the use of getchar() function?

622


Why do we use & in c?

583


What is the difference between array_name and &array_name?

774


Explain pointers in c programming?

628


Tell me what are bitwise shift operators?

650


Explain zero based addressing.

601


What is #include stdlib h?

610


explain what is a newline escape sequence?

681


What is f'n in math?

612


Are the expressions * ptr ++ and ++ * ptr same?

663