Explain the pointers for inter-function communication in C language.

We know that functions can be called by value and called by reference.

  • If the actual parameter should not change in called function, pass the parameter-by value.
  • If the value of actual parameter should get changed in called function, then use pass-by reference.
  • If the function has to return more than one value, return these values indirectly by using call-by-reference.

Read Also: Function Call by Value in C and Function Call by Reference in C


Following is the C program for the demonstration of returning the multiple values −

 Live Demo

void main() {
   void areaperi(int,int*,int*);
   int r;
   float a,p;
   printf("enter radius of circle:
");    scanf("%d",&r);    areaperi(r,&a,&p);    printf("area=%f
",a);    printf("perimeter=%f",p); } void areaperi(int x,int *p,int *q) {    *p=3.14*x*x;    *q=2 * 3.14*x; }


When the above program is executed, it produces the following output −

Enter radius of circle: 5


  • Pointers have a type associated with them. They are not just pointer types, but rather are the pointer to a specific type.
  • The size of all pointers is same, which is equal to size on int.
  • Every pointer holds the address of one memory location in computer, but the size of a variable that the pointer refers can be different.

Updated on: 20-Jun-2024

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started