Question 4
What is the fundamental conceptual difference between "pass-by-value" and "pass-by-reference" for function parameters in C?
Pass-by-value is used for primitive types, while pass-by-reference is used for composite types.
In pass-by-value, a function works with a copy of the argument, whereas in pass-by-reference, it works with the original variable via its memory address.
Pass-by-value allows a function to modify the original variable, while pass-by- reference protects the original variable from modification.
The choice between pass-by-value and pass-by-reference is made automatically by the compiler based on the variable's type.