Ask Question

Write a recursive function stringReverse that takes a character array as an argument, prints it back to front and returns nothing. The function should stop processing and return when the terminating null character of the string is encountered.

+2
Answers (1)
  1. 10 March, 19:23
    0
    Refer below for the code.

    Explanation:

    #include

    void stringReverse (char[]);

    //function declaration

    int main ()

    / / main function

    {

    char str[25];

    printf ("String to reverse: ");

    / / user input

    scanf ("%s", str);

    printf ("/nString that is reversed is: / n"); / /

    stringReverse (str);

    return 0;

    }

    void stringReverse (char*arrayString)

    {

    if (*arrayString=='/0') {

    return;

    }

    else{

    stringReverse (arrayString+1);

    }

    printf ("%c", arrayString[0]);

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a recursive function stringReverse that takes a character array as an argument, prints it back to front and returns nothing. The ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers