C Online Compiler
Example: C program to find the Length of a String
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// C program to find the Length of a String #include <stdio.h> // It's the main function of the program int main() { char str[] = "This is my first program"; int i; // Iterate over the string the count the total characters for (i = 0; str[i] != '\0'; i++); // Final output of the progrm printf("String Length: %d\n", i); return 0; }
Output
Clear
ADVERTISEMENTS