Here is source code of the C Program to illustrate pass by value. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C Program to Illustrate Pass by Value.
void swap(int a, int b)
temp = a;
a = b;
b = temp;
int num1 = 10, num2 = 20;
printf("Before swapping num1 = %d num2 = %d\n", num1, num2);
printf("After swapping num1 = %d num2 = %d \n", num2, num1);
Output: $ cc pgm43.c $ a.out Before swapping num1 = 10 num2 = 20 After swapping num1 = 20 num2 = 10
Sanfoundry Global Education & Learning Series – 1000 C Programs.
Here’s the list of Best Reference Books in C Programming, Data-Structures and Algorithms