Passing pointers to functions in C
Pointers in C are often passed to a function as arguments. This allows data items within the calling portion of the program to be accessed by the function, altered within the function, and then returned to the calling portion of the program in altered form. We call this use of pointers in functions as passing arguments by reference (or by address or by location), in contrast to passing arguments by value.
When an argument is passed by value, the data item is copied to the function. Thus, any alteration made to the data item within the function is not carried over to the calling routine. However, when an argument is passed by reference (i.e., when a pointer is passed to a function), the address of a data item is passed to the function. The contents of that address can be accessed freely, either within the function or within the calling routine.
Moreover, any change that is made to the data item (i.e., to the content of the address) will be recognized in both, the function and the calling routine. Thus, the use of pointer as a function argument permits the corresponding data item to be altered globally from within the function.
Nice tutorial bro..