Pages

Saturday, June 16, 2012

calling the function

#include<stdio.h>
#include<conio.h>
void swap(int,int);
void main()
{
    int a,b;
    clrscr();
    printf("\n\t Enter a=");
    scanf("%d",&a);
    printf("\n\t Enter b=");
    scanf("%d",&b);
    printf("\n\t Before calling the function");
    printf("\n\t a=%d b=%d",a,b);
    swap(a,b);
    printf("\n\t after calling the function");
    printf("\n\t a=%d b=%d",a,b);
    getch();
}
void swap(int x,int y)

{
    int temp;
    temp=x;
    x=y;
    y=temp;
    return;
}




No comments:

Post a Comment