View Single Post
  #3 (permalink)  
Old 04-09-2012, 03:41 AM
Stefan Ram
Guest
 
Posts: n/a
Default Re: String reverse function/ global array modification help

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>Tyler <tylerodyssey@gmail.com> writes:
>>read a string and print it in reverse (25)

>(...)
>>maximum array size is 100

>If the length of the input string is not limited, but the
>size of arrays is limited to 100, then complicated
>constructions have to be used to cope with long inputs.


That is, of course, unless one is using something like:

#include <stdio.h>

void reverse( void )
{ int const c = getchar(); if( c != EOF ){ reverse(); putchar( c ); }}

int main( void ){ reverse(); putchar( '\n' ); }

Reply With Quote