Hello i know a bit about pointers in C but the problem I am running into is how to access variables in an t开发者_如何学Chis typedef enum.
The structure is defined as:
typedef enum {
ZERO = (uint8_t) 0, ONE = (uint8_t) 1
} BIT;
typedef BIT lc3_word_t[16];
and the method that is calling it is:
word_not(lc3_word_t *R, lc3_word_t *A) {
/*int i;
for (i=0;i<16;i++){
printf("Current i is: '%d' and the value is: '%d' \n", i, *A[i]);
//lc3_word_t a_value = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1}; // 13
}
*/
}
The commented out section is what I have been trying along with some other variations that were introduced in this post: Understanding C: Pointers and Structs
If anyone could help me get this it would be greatly appreciated. THanks
You want to use (*A)[i], not *A[i].
精彩评论