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
I need previous papers of CSC.......plz help out by posting them.......
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
Explain pointer. What are function pointers in C?
What is property type c?
How can I find out the size of a file, prior to reading it in?
Can we change the value of static variable in c?
Differentiate between null and void pointers.
Disadvantages of C language.
Is c still used?
Explain how can you tell whether a program was compiled using c versus c++?
What is size of union in c?
How can I insert or delete a line (or record) in the middle of a file?
How can I get random integers in a certain range?
What is a pointer and how it is initialized?
How can you call a function, given its name as a string?