Program to find the length of a string in C, CPP, C Plus Plus with the flowchart
In this tutorial, we will answer the following questions;
- Flowchart of a program to find the length of a string.
- Program to find the length of a string in C Plus Plus.
- Program to find the length of a string in C.
Flowchart of a program to find the length of a string

Program to find the length of a string in C Plus Plus
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include<iostream> #include<stdio.h> #include<conio.h> #include<string.h> using namespace std; int main() { char str[86]; int length; cout<<"Please Enter String: "; gets(str); length = strlen(str); cout<<"Please String Length: "<<length; return 0; } |
Output

Program to find the length of a string in C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include<stdio.h> #include<conio.h> #include<string.h> int main() { char str[86]; int length; printf("Please Enter String: "); gets(str); length = strlen(str); printf("String Lengthis= %d",length); return 0; } |
Output
Figure: Output of program for finding the string length.