Welcome to W3Courses
 Like Us on Facebook

Source Code to Print out the Length of a String in C Programming

The following source code will print out the length of a string in C Programming

#include <stdio.h>
{  char s[81];
printf("Enter string: ");
scanf("%s", s);
printf("length = %d\n", len(s));
int len(char s[])
{  if(*s)
        return 1+len(++s);
return 0;