Call-by-value-function in c .

In this session i have discussed call by value function in C .

In call by value , the original value can not be changed or modified because when you passed the value to the function parameter it is locally stored in function parameter memeory address . So it can not change the varible value inside the caller function in main() because the variable inside the main() is stored at different memory location .

Example : Write a program that demonstrate the call by value function .

    void display(int x);
    int main()
          int x;
          printf(" Value display from function\n ");
          printf("\nValue display from x variable\n");
          printf("x : %d",x);
          return 0;
    void display(int x)
        printf("x : %d",x);
    OUTPUT : Value display from function
             x : 20
             Value display from x variable
             x : 10

Welcome to AndroidATPoint.

back image                     next image