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
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
Explain the meaning of keyword 'extern' in a function declaration.
What is the usage of the pointer in c?
What does 2n 4c mean?
Why do we use main function?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
Are negative numbers true in c?
How can I write a function analogous to scanf?
Where does the name "C" come from, anyway?
Why do we use header files in c?
Why c is called a middle level language?
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
`write a program to display the recomended action depends on a color of trafic light using nested if statments
Where are c variables stored in memory?
What are the types of pointers in c?