C Programming Pointers and Functions
C Programming Pointers and Functions
by Reference
When, argument is passed using pointer, address of the memory location is passed instead of value.
Output
Number1 = 10
Number2 = 5
Explanation
The address of memory location num1 and num2 are passed to function and the pointers *a and *b accept those
values. So, the pointer a and b points to address of num1 and num2 respectively. When, the value of pointer are
changed, the value in memory location also changed correspondingly. Hence, change made to *a and *b was
reflected in num1 and num2 in main function.
This technique is known as call by reference in C programming.