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

what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2379


Explain the meaning of keyword 'extern' in a function declaration.

1125


What is the usage of the pointer in c?

1060


What does 2n 4c mean?

1196


Why do we use main function?

1120


my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?

1542


Are negative numbers true in c?

1008


How can I write a function analogous to scanf?

1111


Where does the name "C" come from, anyway?

1093


Why do we use header files in c?

1030


Why c is called a middle level language?

1061


a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

1041


`write a program to display the recomended action depends on a color of trafic light using nested if statments

2084


Where are c variables stored in memory?

1031


What are the types of pointers in c?

980