Example of call by value in C Program

Long Answer
Views 869

Answer:


#include <stdio.h>  
void change(int,int);  
int main()  
{  
    int a=10,b=20;  
    change(a,b); //calling a function by passing the values of variables.  
    printf("Value of a is: %d",a);  
    printf("\n");  
    printf("Value of b is: %d",b);  
    return 0;  
}  
void change(int x,int y)  
{  
    x=13;  
    y=17;  
}  

Output

Value of a is: 10
Value of b is: 20

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of C Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.