10-26-2017 10:04 AM
if I declare an array
double test_values [] = {20.0, 30.0, 50.5, 101.5, 200.5};
if(debug)
{
test_values [] = {20.0, 30.0,};
}
......
I got a compile error: expected expression
but if I do this
double test_values [] = {20.0, 30.0, 50.5, 101.5, 200.5};
if(debug)
{
double test_values [] = {20.0, 30.0,};
}
......
during debug I found that the code stepped into the debug loop but the test_values array still have the original values (5 elements) instead of the debug values (2 elements)
I'm using LabWindows CVI 2015
Thanks in advance if you can help to answer
Solved! Go to Solution.
10-26-2017 05:39 PM - edited 10-26-2017 05:41 PM
The reason for the first error is quite clear: the compiler assumes you want to assign an array element a value, but complains that no actual element is stated.
As per your second example, I don't think you can resize the array this way. I would rather rephrase the code using some preprocessor directive:
#ifdef _CVI_DEBUG_ double test_values [] = {20.0, 30.0}; #else double test_values [] = {20.0, 30.0, 50.5, 101.5, 200.5}; #endif