#include <stdio.h>
#include <stdlib.h>

main()
{
char a[30],b[30];
int i,j,n;
printf("enter the limit: ");
scanf("%d",&n);
printf("enter the string: ");
for(i=0;i<n;i++)
{
    scanf("%s",a[i]);
}
j=strlen(a[0]);
printf("%d",j);
}

here for example it will take 4 words where a[0]=word1,a[1]=word2,a[2]=word3,a[3]=word4 where i have particularly find string length of a[0] in 15 th line i have done that j=strlen(a[0]) is it possible

Recommended Answers

you probably wanted to use a 2d array like char a[30][30];

Jump to Post

All 3 Replies

you probably wanted to use a 2d array like char a[30][30];

can u explain with me a example i didnt get u properly

change line 6 to char a[30][30] (a 2 dimensional array) instead of char a[30],b[30]; (2 arrays where array b is unused)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.