Hi,
can anyone explain why I get different output, if I call the function main() or run()?
Code
int count;
function main() //run()
{
	vars MySeriesArrayX = series(); 
	vars MySeriesArrayY = series(); 
	if (count!=1){
		int x;
		for(x=0; x<5; x++) {
			MySeriesArrayX[x] = 20220101+x;
			MySeriesArrayY[x] = x+0.1;
		}
		
		int date;
		for(x=0; x<5; x++){		
			date = MySeriesArrayX[x];
			printf("\n date: %d",date);
			printf("\n number: %f",MySeriesArrayY[x]);
			
		}
		count=1;
	}
}


If it is called main() the output is correct:

date: 20220101
number: 0.100000
date: 20220102
number: 1.100000
date: 20220103
number: 2.100000
date: 20220104
number: 3.100000
date: 20220105
number: 4.100000


If it is called run() date returns the int of number:

date: 0
number: 0.100000
date: 1
number: 1.100000
date: 2
number: 2.100000
date: 3
number: 3.100000
date: 4
number: 4.100000

I edited the code to the core problem.
If I comment out the count and the if-case, then it is wrong in the first 'run' of run() and after that it shows also correct results.

Thanks for any help.



Last edited by DisplayName; 03/22/23 12:40.