Neo said:
>If i have a :[Please note that there are two (part 11)'s in the "Han from
typedef struct str32{
uint32_t word1;
uint32_t word2;
} word_array;
word_array *my_array;
what would be the data type of this:
myarray->word1
How come it is a uint32_t type and is giving the value of word1? isn't
it still a pointer which is not dereferenced yet?
I was thinking I should have to do *(my_array->word1) to get to
uint32_t type, what goes?
China answers your C questions" series. Sorry about that. You can
tell I got an F in math at school.]
Neo, buddy, I've decided to give you a little summary for reference
so that you don't have to sift through excess verbiage, cryptic
meanderings, and irrelevant matters of naming to make sense of this
thing. Please forgive any typos on my part.
word_array my_structure;
word_array *my_structure_pointer;
my_structure_pointer = &my_structure;
&my_structure - address of my_structure
my_structure_pointer - address of my_structure
&my_structure_pointer - address of my_structure_pointer
my_structure - refers to my_structure (obviously)
*my_structure_pointer - refers to my_structure
my_structure.word1 - access word1
(*my_structure_pointer).word1 - access word1 (parentheses needed)
my_structure_pointer->word1 - access word1 (shorthand for the previous)
&my_structure.word1 - address of word1
&(*my_structure_pointer).word1 - address of word1
&my_structure_pointer->word1 - address of word1
my_structure_pointer.word1 - DON'T DO THIS
(*my_structure).word1 - DON'T DO THIS
my_structure->word1 - DON'T DO THIS
Yours,
Han from China