-->

Call by Reference

Call by Reference in C Programming
Call by Reference

In the call by reference method, instead of passing values to the function that is being called, references/pointers to the original variables are passed.
int a=1;
void fun(int*x)
fun(&a);
{
Definition;
}

Note: Any modification which is done to variable ‘a’ will change the outside function.

Example:
void main()
{
int a=10; //a is read as 10
printf(“%d”,a);
fun(a);
printf(“%d”,a); //a is read as 10
}
void fun(int x) //a is read as 10
{
printf(“%d”,x);
x++;
prinf(“%d”,x) //x is read as 11
}

OUTPUT
10 10 11 11

call by value,call by reference,what is call by value,define call by value in functions,functions in c language,jntuh cse study material,jntu study material for first year,jntuh b.tech r18 cse study material, jntuh 3 2 cse study materials,jntuh 4-2 cse study materials,jntuh 2-2 cse study materials, jntuh 2-1 cse study materials,jntuh 3-1 cse study materials,jntuh 4-1 cse study materials, jntuh b.tech r16 syllabus,jntuh b.tech r18 syllabus,jntuh b.tech r16 3-2 syllabus,jntuh b.tech r16 2-2 syllabus, r16 jntu lecture notes,r18 jntu lecture notes, jntuh 2-1 lecture notes,jntuh 3-1 lecture notes,jntuh 4-1 lecture notes, jntuh 2-2 lecture notes,jntuh 3-2 lecture notes,jntuh 4-2 lecture notes, jntuh computer programming in c lecture notes, jntuh r16 computer programming in c notes pdf, jntuh r18 computer programming in c notes pdf,jntuh r18 syllabus pdf,estudies4you,c language lecture notes jntuh,r18 c language lecture notes,

Related Posts

Subscribe Our Newsletter