Array program collection C
/* program to store multiple strings and count total their characters
*/
#include<stdio.h>
int main()
{
char string[5][100]={"c program","C++ code","JS code","php code","java code"};
int i,j,count;
for(i=0;i<=4;i++)
{
count=0;
for(j=0;string[i][j]!='\0';j++)
{
count++;
}
printf("the string is %s and its length is %d\n",string[i],count);
}
return 0;
}
No comments:
Post a Comment