[futurebasic] C array garbage value

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

From: Ken Shmidheiser <kshmidheiser@...>
Date: Fri, 10 Feb 2017 19:17:53 -0500
Bernie asked:

> Anyone got a better idea?

Gentlemen,

I've been battling some sickness and am a little out the loop,  but constructing Bernie's code with the following, I am not getting any errors.

Also, since d is dimensioned in the for/next loop, and then redimensioned outside the loop, I wonder if

int e = dim[1];   // garbage value

in Bernie's code might produce different results.

The way I feel, I could be misunderstanding the question.

Ken


include "NSLog.incl"

BeginCFunction
long MyFunction1( long count )
{
   long dim[count];
   for ( long d = 0; d < count; d++ )
   {
       dim[d] = 15;
   }
   long d = dim[1];   // garbage value
   NSLog(@"%lu",d);

return d;
}
EndC
toolbox fn MyFunction1( long ) = long

fn MyFunction1( 10 )

RunApplicationEventLoop()