Multiple choice general knowledge

In C, to find out the length of string "hello", what is the correct code?

  1. strlen(hello)

  2. StrLen(hello)

  3. strlen("hello")

  4. strlength("hello")

  5. length("hello")

Reveal answer Fill a bubble to check yourself
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.