A program to explain CALL BY VALUE
C Programming Language 082
- Write a program to explain CALL BY VALUE
Program
#include <stdio.h>
void swap(int, int);
void main()
{
int a = 10, b = 20;
printf("Before swapping...\n");
printf("a = %d\n", a);
printf("b = %d\n", b);
printf("\n");
swap(a, b);
printf("After swapping...\n");
printf("a = %d\n", a);
printf("b = %d\n", b);
printf("\n");
}
void swap(int x, int y)
{
int t;
t = x;
x = y;
y = t;
}
Result
Before swapping...
a = 10
b = 20
After swapping...
a = 10
b = 20
Last Updated on
Comments