Â
In this, we are going to see a program in which the length of the string is calculated using an in-built function of string.h header file in C Programming Language.
// find length of string using strlen()
#include <stdio.h>
#include <string.h>
int main()
{
char a[10];
int length;
printf("Enter a string\n");
gets(a);
//strlen() calculates the length of the string
length = strlen(a);
printf("The length of the string is:%d", length);
return 0;
}
//..........coded by ANANYA MAURYA
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP