Editorial Staff - - C Programming Tutorial
In this program, we are going to share a c program to illustrate pass by value. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a c program to illustrate pass by value with the output.
We have designed this program for beginners for learning purpose. Copy below c program and execute it with c compiler to see the output of the program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #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; } |
Before swapping num1 = 10 num2 = 20
After swapping num1 = 20 num2 = 10
Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari View all posts by Editorial Staff