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
How can I use a preprocessorif expression to ?
How to set file pointer to beginning c?
What is pointers in c?
Is there any demerits of using pointer?
What is a pointer in c plus plus?
What is a program flowchart?
What does int main () mean?
What is sizeof array?
How can I open files mentioned on the command line, and parse option flags?
What is the difference between variable declaration and variable definition in c?
Why do we need volatile in c?
Which is the best website to learn c programming?
What is masking?
What is ctrl c called?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321