In C, to find out the length of string "hello", what is the correct code?
-
strlen(hello)
-
StrLen(hello)
-
strlen("hello")
-
strlength("hello")
-
length("hello")
C
Correct answer
Explanation
In C programming, strlen() is a standard library function from string.h that calculates the length of a string. It requires the string to be passed as an argument with quotes, making strlen("hello") the correct syntax. Options A and B are missing quotes, while D and E are not valid C functions.