I want to find if there is a way to find the length of any string in C.
How I did it:
#include <stdio.h>
int main()
{
char s[10] = "hello";
int i , len = 0;
for(i = 0; s[i] != '\0'; i++)
{
len++
}
printf("length of string is: %d" , len);
return 0;
}
I want to find if there is a way to get the line length in only one line of code.
source
share