google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a c program to illustrate call-by-value parameter passing technique - 2nd puc computer science

Write a c program to illustrate call-by-value parameter passing technique

call by value in c example,call by value program in c,example of call by value

Write a c program to illustrate call-by-value parameter passing technique

#include<stdio.h>

#include<conio.h>

void main()

{

void swap(int,int);

int a,b;

clrscr();

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

scanf("%d%d",&a,&b);

printf("Before calling the function a=%d and b=%d\n",a,b);

swap(a,b);

printf("After calling the function a=%d and b=%d",a,b);

getch();

}

void swap(int x, int y)

{

int temp;

temp=x;

x=y;

y=temp;

}

Output:

Enter two numbers:

2                                                                              

4                                                                              

Before calling the function a=2 and b=4                                         

After calling the function a=2 and b=4                                         

Note: In this program the swapping of numbers does not take place.


Write a c program to illustrate call-by-value parameter passing technique Write a c program to illustrate call-by-value parameter passing technique Reviewed by Vision Academy on December 14, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.