Call by reference in C by R4R Team

Call by reference:
-Here call by reference means we call a function and pass variable reference instead of variable value.
-Pointer are used in such kind of calling.


#include< stdio.h>
int func(int *a, int *b)
int t;
int main() {
int i,j;
printf("Enter two numbers\n");
printf("Before function calling\");
printf("%d %d",i,j);
printf("After function calling");
printf("%d %d",i,j);



Enter two number
3 4
Before function calling
3 4
After function calling
4 3

-In this program, we take an input of two integer number and display them before function calling.
-Pass these number in function with variable reference.
-Function swap the new variable inside it but you can see the change in actual values also, so this kind of function calling is known as call by refrence.

Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!