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
What are lookup tables in c?
Explain two-dimensional array.
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
Is main an identifier in c?
What are structure types in C?
Why double pointer is used in c?
using for loop sum 2 number of any 4 digit number in c language
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
What is data structure in c programming?
How do you define a string?
What are the application of c?
What is const keyword in c?
Is there a way to switch on strings?
What does main () mean in c?
Why structure is used in c?