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();
}

Happy Independence Day August 15th

 Here's a message for India's Independence Day (August 15th): "शुभ स्वतंत्रता दिवस! आजादी की 79वीं वर्षगांठ पर, आइए हम अपने देश...