Shell - c Full Example
Mark Wieder
ahsoftware at sonic.net
Thu Jun 29 23:20:53 EDT 2017
On 06/29/2017 07:40 PM, JB via use-livecode wrote:
> char* getReverse(char const str[]){
> static int i=0;
> static char rev[MAX];
>
> if(*str){
> getReverse(str+1);
> rev[i++] = *str;
> }
>
> return rev;
> }
Nice use of recursion, but note that you're susceptible to buffer
overflow if you don't limit str to MAX-1 chars. And rev should be
null-terminated.
--
Mark Wieder
ahsoftware at gmail.com
More information about the use-livecode
mailing list