adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Write a program in C to show the call by reference.

Write a program in C to show call by reference.

#include<stdio.h>
#include<conio.h>
  int swap(int *x,int *y);
  void main()
   {
    int a,b;
    printf("Enter two nos:-");
    scanf("%d%d",&a,&b);
    printf("Value of a=%d  & Value of b=%d before swap.",a,b);
    swap(&a,&b);
    printf("\nValue of a=%d  & Value of b=%d after swap.",a,b);
    getch()
   }
  int swap(int *x,int *y)
    {
     int temp;
     temp=*x;
     *x=*y;
     *y=temp;
    }
   
Output:- 

Post a Comment

0 Comments