Write a Program to illustrate Array with Strings?
main()
{
static char name[]="devdas";
int i;
i=0;
while(name[i]!='\0')
{
printf("%c",name[i]);
i=i+1;
}
}
In the 'name' array and the zero th character is'd', the first one is 'e' etc. The loop confirms for the null character to find if the character array is terminated. When it finds one then it jumps out of the loop. The program doesn't rely ahead the length of the string instead it looks for the null character to check whether the array has ended.