Login Page - Create Account

Support Board


Date/Time: Sun, 09 Mar 2025 13:31:26 +0000



Post From: corruption of variables on simple code using standard arrays

[2022-03-01 13:23:21]
User907968 - Posts: 838

for (int i=99;i>=0;i--){
tempi[i+1]=tempi[i];
tTot=tTot+tempi[i];

There is an array bounds error during the first iteration of the for loop.
iter 1: i = 99
therefore: i + 1 = 100

100 is beyond the end of the array, so this is undefined behavior.