[futurebasic] Re: [FB] C array garbage value

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2017 : Group Archive : Group : All Groups

From: Bernie <bernie.fblist@...>
Date: Sat, 11 Feb 2017 17:16:38 +0000
Ken wrote:
> 
> BeginCFunction
> void MyFunction1( int count ) {
>    int dim[count];
>   memset( dim, 0, sizeof(dim) );
>    for ( int d = 0; d < count; d++ ) {
>        dim[d] = 15;
>    }
>    int d = dim[1];    // garbage value -- please gimme a break
>    NSLog(@"%d",d);
> }
> EndC

Excellent! Thanks Ken.

I’ve now rewritten the two methods to eliminate the build of a C array or NSArray of arguments, but will archive your fix for when this comes up again.

Cheers