开发者

Calling variables with pointers in a typedef

开发者 https://www.devze.com 2023-04-07 15:09 出处:网络
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.

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].

0

精彩评论

暂无评论...
验证码 换一张
取 消