In this simple C code example we tried to show the difference between function call by value and call by reference in C programming. In function call by value the original variables are not affected because the values are copied inside function definitions. Whereas in function call by reference the original variables are affected because we pass the memory addresses inside function definitions. [js] #include <stdio.h> void swapCallByValue(int x1, int y1); // this is prototype of our function (call by value) void swapCallByReference(int *x1, int *y1); // this is prototype of our function (call by reference) int main(void){ // in...
forward
Recent Comments
Archives
- November 2024
- July 2021
- December 2020
- November 2020
- September 2020
- August 2020
- July 2020
- April 2020
- March 2020
- February 2020
- January 2020
- December 2019
- October 2019
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- March 2017
- January 2017
- December 2016
- November 2016
- October 2016
- June 2015
- May 2015
- April 2015