This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Strange question about Array

I declare a array, and set the value.

ubyte i,ubData[3];
for(i=0;i<3;i++)
ubData[i]=i;

I debug this program ,the value of array element is correct. But when i download the program into flash,I find the value of array element is 0xff. The value of element is error.
For example , the value of ubData[1] is 0xff,not 1.

So i modify the program like this:

ubData[0]=0;
ubData[1]=1;
ubData[2]=2;

I download the program into flash again,run it. The value of array element
is correct. The value of ubData[1] is 1.

If I set the array element value like :
i=0;
ubData[0]=i;
The real value of ubData[0] is 0xff,but not 0. Why?

I can't explain this.