// Write a Program for call by value
#include <stdio.h>
#include<conio.h>
// Function Prototype
void swapx(int x, int y);
// Main function
void main()
{
int a,b;
// Actual Value
printf(“Please Enter The Value of A & B\n”);
scanf(“%d%d”,&a,&b);
printf(“The Actual value of a=%d & b=%d\n”,a,b);
// Pass by Values
swapx(a, b);
printf("The Actual Value of A & B after swapping a=%d & b=%d\n", a, b);
}
// Swap functions that swaps
// two values
void swapx(int x, int y)
{
int t;
t = x;
x = y;
y = t;
printf("The Value after swapping x=%d & y=%d\n", x, y);
}
|
Write a Program for call by value in C
Friday, April 17, 2020
0
Tags
Share to other apps