#include<stdio.h>
#include<string.h>intmain(){chars[50];printf("———————————————————————————————————————————");printf("\nProgram to print length of a given string");printf("\n———————————————————————————————————————————");printf("\nEnter the string ");scanf("%s",s);intl=strlen(s);printf("\nLength of string is %d",l);printf("\n———————————————————————————————————————————\n");return0;}
Output
codeaft@codeaft:~$ gcc codeaft.c codeaft@codeaft:~$ ./a.out
———————————————————————————————————————————
Program to print length of a given string
———————————————————————————————————————————
Enter the string CODEAFT
Length of string is 12
———————————————————————————————————————————
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.