1.

Write C function named ‘fiddle’ that takes two arguments, x and y and changes both values. x is an int while y is a pointer to int

Answer»

C function named ‘fiddle’ that takes two arguments, x and y and changes both values. x is an int while y is a pointer to int

#include<conio.h>

void main()

{

int x,z,*y,temp;

clrscr();

printf("\n Enter two numbers : \n");

scanf("%d %d",&x,&z);

y=&z;

printf("\n\n x = %d and y = %d",x,*y);

fiddle(&x,y);

printf("\n After changing their values ");

printf("\n x = %d and y = %d",x,*y);

getch();

}

fiddle(int *a,int *b)

{

int temp;

temp=*a;

*a=*b; 

*b=temp;

getch();

}  



Discussion

No Comment Found

Related InterviewSolutions