Hi list, i'm working with c51v750a. My problem:
int array[ 0] _at_ 0x7600; //xdata unsigned char index = 0; //xdata printf("%d", &array[ index]); printf("%d", &array[(unsigned char)(index - 1)]); //what is wrong? // Result: // 30208 --> 0x7600 (correct) // 30206 --> 0x75FE == array[ -1] incorrect, // expected array[255] @ 0x77FE
Hi, Not realy an answer but a question, doesn't the line 'array[0] _at 0x7600' generate a compiler error (invalid dimension size)? and should instead be 'array[0x0100] _at 0x7600' But as regards your question, what you have written is what i would expect and to me suggests that keil are treating the index as signed even though you have declared/cast it as unsigned. Mark.