Search This Blog

Translate

C program example swapping of two numbers

C program swapping of two number using call by reference C program swapping of two number using call by reference method with source code, program to swap to number using pointer, swapping of tow number without using third variable c source code


#include<stdio.h>
#include<conio.h>
void swp(int *, int *);

void main()
{
 int a=5;b=9;
 printf("aftere swapping");
 printf("a=%d \t b=%d",a,b);

 swp(&a,&b);
 printf("aftere swapping");
 printf("a=%d \t b=%d",a,b);
}

void swp(int *a,int *b)
{
 int tmp;

  tmp=*a;
 *a=*b;
 *b=tmp;

}

C Program example List

Google+ Badge