Intro:
We know that there is two methods to pass the data into the main function in embedded c. (i.e. call by value and call by reference)

Call by Value
- In c here are actual and formal parameters present so in call by value method , the value of the actual parameters is copied into formal parameters.
- Another one difference is in call by value methods different memory is allocated for actual as well as formal parameters so the value of actual parameters is copied into formal parameters.
- Let’s try to understand the concept call by value in embedded c by example :
Embedded c program in embedded c
#include<stdio.h>
void change(int num)
{
printf("Before add%d\n",num); //num is formal parameter
num=num+100;
printf("After add%d\n",num);
}
int main()
{
int x=100;
printf("Before fcall%d\n",x); //x is actual parameters
change(x); //passing value in function
printf("After fcall%d\n",x);
return 0;
}
Output:
/tmp/mLGLENYMwZ.o
Before fcall100
Before add100
After add200
After fcall100

Summary:
In this article we saw basics of call by value concepts.