In this program, we are going to share a C program find the length of the linked list using recursion. 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 find the length of the linked list using recursion 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: 5
The number of characters in 5 are 1.
Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari View all posts by Editorial Staff