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

What are lookup tables in c?

970


Explain two-dimensional array.

1026


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

2151


Is main an identifier in c?

1105


What are structure types in C?

1071


Why double pointer is used in c?

1003


using for loop sum 2 number of any 4 digit number in c language

2284


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

1174


What is data structure in c programming?

1046


How do you define a string?

1064


What are the application of c?

1060


What is const keyword in c?

1136


Is there a way to switch on strings?

1050


What does main () mean in c?

1076


Why structure is used in c?

1139