[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Strings

Home > Programs > Strings

91 / 60

Write a recursive function to find the length of the of string.

Answer:

#include 
#include 
using namespace std; 
int stringLength(char *str)
{
    static int length=0;
    if(*str!=NULL)
    {
        length++;
        stringLength(++str);
    }
    else
    {
        return length;
    }
}
int main()
{
    char str[100];
    int length=0;    
    cout

Asked In :: PEOL

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here: