programming-examples/c/_Basic/C Program to Illustrate Pass by Value.c
2019-11-15 12:59:38 +01:00

21 lines
381 B
C

/*
* C Program to Illustrate Pass by Value.
*/
#include <stdio.h>
void swap(int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
int main()
{
int num1 = 10, num2 = 20;
printf("Before swapping num1 = %d num2 = %d\n", num1, num2);
swap(num1, num2);
printf("After swapping num1 = %d num2 = %d \n", num2, num1);
return 0;
}