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...

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

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,*ptr1,*ptr2,temp;
printf("enter the values ");
scanf("%d%d",&a,&b);
ptr1=&a;
ptr2=&b;
temp=(*ptr1);
*ptr=(*ptr2);
*ptr2=temp;
printf("\n now the values are a=%d b=%d ",a,b);
getch();
}


thank u

Is This Answer Correct ?    4 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I use a preprocessorif expression to ?

998


How to set file pointer to beginning c?

1145


What is pointers in c?

1067


Is there any demerits of using pointer?

1015


What is a pointer in c plus plus?

1218


What is a program flowchart?

1125


What does int main () mean?

959


What is sizeof array?

1002


How can I open files mentioned on the command line, and parse option flags?

1015


What is the difference between variable declaration and variable definition in c?

1015


Why do we need volatile in c?

1118


Which is the best website to learn c programming?

1032


What is masking?

1102


What is ctrl c called?

1002


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

3632