Programming with Passion

Make the best out of everything.

Tuesday 19 September 2017

Reversing a string without using array or pointer.

This program will reverse a string without using array or pointer (only a character variable)
Before looking at the program try to solve it by yourself.
Hint : Use recursion 

#include<stdio.h>
char ch()
{
    char c;
    c=getchar();
    if(c==EOF)return 'a';

    ch();

    printf("%c",c);

}

void main()
{
    ch();
}

Happy Coding. :)

No comments:

Post a Comment