Saturday, 16 July 2016

Call By Value




#include<stdio.h>
int main()
{
    int a,b;
    printf("Enter value of a:");
    scanf("%d",&a);
    printf("\nEnter value of b:");
    scanf("%d",&b);

    printf("Before swapping\n");
    printf("a=%d\n",a);
    printf("b=%d\n",b);

    swap(a,b);
    return 0;
}
void swap(int a,int b)
{

    int temp;
    temp=a;
    a=b;
    b=temp;

    printf("After swapping\n");
    printf("a=%d\n",a);
    printf("b=%d\n",b);
}

0 comments:

Post a Comment