Shin0mar
Shin0mar

Reputation: 41

Calling variables with pointers in a typedef

Hello i know a bit about pointers in C but the problem I am running into is how to access variables in an this 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

Upvotes: 1

Views: 73

Answers (1)

Vaughn Cato
Vaughn Cato

Reputation: 64308

You want to use (*A)[i], not *A[i].

Upvotes: 2

Related Questions