Shell - c Full Example

JB sundown at pacifier.com
Thu Jun 29 23:25:34 EDT 2017


Thanks for the code tip, Mark.

JB


> On Jun 29, 2017, at 8:20 PM, Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 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
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list