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 / amritpal singh

#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;

void swap(int *,int *); //Functioin Prototype
clrscr();
cout<<"\nEnter the number::\n";
cin>>a>>b;
cout<<"\nValues before INterchange are \na=<<" and \nb="<<b;

swap(&a,&b); //Functiion Calling

cout<<"\nValues after interchange\na=<<" and \nb="<<b;

getch();
}

void swap(int *a,int *b) //Function Defintioon
int temp;
temp=*a;
*a=*b;
*b=temp;

}




Thanks friends if any mistake pls coorect it by again urs
answer

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a variable be both constant and volatile?

1112


Subtract Two Number Without Using Subtraction Operator

841


What is the difference between break and continue?

1507


Explain what are the different data types in c?

1213


What is an array? What the different types of arrays in c?

1174


What does it mean when a pointer is used in an if statement?

1102


What is extern keyword in c?

1126


What is #line in c?

1010


What are compound statements?

1170


What is the difference between procedural and functional programming?

1072


Explain null pointer.

1105


What is the size of array float a(10)?

1138


Do pointers need to be initialized?

1072


Explain the difference between null pointer and void pointer.

1077


How can I change the size of the dynamically allocated array?

1144