S
Sheldon
Hi,
I have a problem that and the answer eludes me:
I am converting a 2D array to a 1D array within a for loop that looks
something like this:
ii=0;
for (i = 0; i < 300; i++) {
for (j = 0; j < 250; j++) {
oneD1[ii] = TwoD1[j];
oneD2[ii] = TwoD2[j];
oneD3[ii] = TwoD3[j];
ii++;
}
}
I get a segmentation fault and when I print out ii, the values exceeds
the product of 300*250.
Why does this happen when ii starts at zero and increments with 1 after
use? Even if I change ii++ to ii += 1, the same thing happens.
Thanks in advance,
Sheldon
I have a problem that and the answer eludes me:
I am converting a 2D array to a 1D array within a for loop that looks
something like this:
ii=0;
for (i = 0; i < 300; i++) {
for (j = 0; j < 250; j++) {
oneD1[ii] = TwoD1[j];
oneD2[ii] = TwoD2[j];
oneD3[ii] = TwoD3[j];
ii++;
}
}
I get a segmentation fault and when I print out ii, the values exceeds
the product of 300*250.
Why does this happen when ii starts at zero and increments with 1 after
use? Even if I change ii++ to ii += 1, the same thing happens.
Thanks in advance,
Sheldon