LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Can I exit a FOR loop before it has completed its iterations?

HI

can you help me in this program as the loop exits before completing iterations

it stops after i enter the 8th value 

0 Kudos
Message 1 of 3
(1,093 Views)

1. You are defining an array before you even know what the size should be.  This can cause all kinds of memory issues (accessing data that was allocated for something else while writing to your array).

2. I'm left to assume you input 8 for the size.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(1,080 Views)

I moved the post to the LabWindows CVI forum, since it has nothing to do with LabVIEW.

 

There is a bad condition in your C program. You use the unitialized "size" variable to do a static array allocation in line #9. then you read in the size variable from the user.

 

And even if you move the

 

int arr[size]; 

 

after the call to read in the size variable it will not compile in all C compilers properly since they often do static memory allocations for such declarations and will not even compile the code.

 

And to top that all off, a pretty nonsensical post to a completely irrelevant board by a 1 hit wonder user. If there would be as much as the hint of a spam link in the post, I would have flagged it as spam instead.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(1,077 Views)