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

I need previous papers of CSC.......plz help out by posting them.......

2298


Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.

2327


Explain pointer. What are function pointers in C?

1081


What is property type c?

1092


How can I find out the size of a file, prior to reading it in?

1179


Can we change the value of static variable in c?

1034


Differentiate between null and void pointers.

1169


Disadvantages of C language.

1109


Is c still used?

1049


Explain how can you tell whether a program was compiled using c versus c++?

1104


What is size of union in c?

1026


How can I insert or delete a line (or record) in the middle of a file?

1022


How can I get random integers in a certain range?

1069


What is a pointer and how it is initialized?

1161


How can you call a function, given its name as a string?

1159