google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a c program to swap two numbers using call by pointer method - 2nd puc computer science

Write a c program to swap two numbers using call by pointer method

Write a c program to swap two numbers using call by pointer method

#include<conio.h>

void main()

{

void swap(int, int);

int a=10,b=20;

printf(“Entered numbers are a=%d and b=%d\n”,a,b);

swap(a,b);

printf(“Entered numbers after swapping are a=%d and b=%d”,a,b);

getch();

}

void swap(int x, int y)

{

int temp;

temp=x;

x=y;

y=temp;

}

Output:

Entered numbers are a=10 and b=20                                              

Entered numbers after swapping are a=20 and b=10      

Write a c program to swap two numbers using call by pointer method Write a c program to swap two numbers using call by pointer method Reviewed by Vision Academy on December 14, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.