In this program, we are going to share a C program to find the length of the linked list. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a C program to find the length of the linked list with the output.
We have designed this program for beginners for learning purpose. Copy below c program and execute it with c compiler to see the output of the program.
int length(char , int);
printf("Enter a word to count it's length: ");
count = length(word, 0);
printf("The number of characters in %s are %d.\n", word, count);
int length(char word, int index)
if (word[index] == '\0')
return (1 + length(word, index + 1));
Enter a word to count it’s length: freewebmentor
The number of characters in freewebmentor are 13.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.