Function Call by Value and Call by Reference in C Programming

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