Jon Wilder
Active Member
I've notice with pointers, you usually declare a fixed array, then declare a pointer to use with the array. However, I'm having a difficult time understanding the difference between using a pointer and simply using an int variable as the array index.
What's the difference between say -
vs
When I use a pointer, I can see in the disassembly that the compiler uses the FSR/INDF register set. But other than that I don't see any other difference.
What's the difference between say -
Code:
uint8_t array[10];
uint8_t *pointer;
pointer = array;
for(char i = 0; i < 10; ++i){
*pointer = 0;
++pointer:
}
vs
Code:
uint8_t array[10];
for(char i = 0; i < 10; ++i){
array[i] = 0;
}
When I use a pointer, I can see in the disassembly that the compiler uses the FSR/INDF register set. But other than that I don't see any other difference.