Call by Value

Call by value is a value passing mechanism to function in which a value is passed to some function and the function is not responsible for midifying the passed value. If the function modifies any passed values, that value changed locally to the function only. Following example will illustrates the concept.


// type and declaration of function is defined first if function is 
// other than of integer type
void square(int);  // void type, so declaration is compulsory
int main( ) 
    int num;
    printf("Enter number ");
    square(num); // calling function square
    printf("number is %d",num); // value of num is not affected
    return 0;

void square(int number)
    // value modified locally, no effect to passed value
    number = number + 10;
    printf("local value %d\n",number);

You may also like...