
II-172 Programming Concepts
int i,j;
clrscr();
printf("Sorted List of Cities.\n\n");
for(i=65;i<=122;i++)
{
for(j=0;j<5;j++)
{
if(place[j][0]==i)
printf("\n%s",place[j]);
}
}
getche();
}
OUTPUT:
Sorted list of cities.
Bangalore
Chennai
Delhi
Mumbai
Nanded
9. String copy and size of strings
#include <string.h>
void main()
{
char a[33]={"Software people are intelligent"};
char b[60]={"Highly knowledgeable people can design
hardware circuits"};
clrscr();
strcpy(a,b);
printf("\n%s ",a);
printf("\n%d %d",sizeof(a),sizeof(b));
getche();
}
OUTPUT:
Highly knowledgeable people can design hardware circuits
33 60
M08_ITL-ESL4791_02_SE_C08.indd 172 12/22/2012 5:03:31 PM