Problem Solving using C Language

0 of 76 lessons complete (0%)

Functions

Passing values using Functions

Call by Value

In this type of function call, the actual values (arguments) are passed to the function. The function works on these values, but any changes made within the function do not affect the original variables. In C, function calls are typically by value.

Example:

void example(int a) {
    a = 10; 
}

Call by Reference

In this type of function call, the address of the variables is passed to the function. Any changes made to the variables inside the function affect the original variables. This is often done using pointers in C.

Example:

void example(int *a) {
    *a = 10;  
}