google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: C program to swap the values of two variables by using call by references.

Wednesday, April 1, 2015

C program to swap the values of two variables by using call by references.

rite a ‘C’ program to swap the values of two variables by using call by references.

#include<stdio.h>
#include<conio.h>
void main()
{
char name[5][10],temp[10];
int i,j;
clrscr();
printf("\nENTER THE 5 NAMES");
for(i=0;i<5;i++)
{
scanf("%s",&name[i]);
}
for(i=0;i<5;i++)
{
for(j=i+1;j<5;j++)
{
if(strcmp(&name[i],&name[j])>0)
{
strcpy(temp,&name[i]);
strcpy(&name[i],&name[j]);
strcpy(&name[j],temp);
}
}
}
printf("\n SORTED NAMES ARE \n");
for(i=0;i<5;i++)
{
printf("%s\n",name[i]);
}
getch();
}

अच्छे विचार करे विचार

  पहचान की नुमाईश, जरा कम करें... जहाँ भी "मैं" लिखा है, उसे "हम" करें... हमारी "इच्छाओं" से ज़्यादा "सुन...