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 list all of the predefined identifiers?
When can you use a pointer with a function?
Can the “if” function be used in comparing strings?
what is the role you expect in software industry?
What are valid signatures for the Main function?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
What is pointers in c?
What is .obj file in c?
Which is better between malloc and calloc?
What is a program flowchart and how does it help in writing a program?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
Is c weakly typed?
Write a program to swap two numbers without using third variable in c?
how to construct a simulator keeping the logical boolean gates in c