I know that with arrays when intitiated create a word with an addressable address to the array as a whole, and minor address to the elements in the array.
Like code below
Code:
int main(void)
{
int i,data[4] = {4, 3, 0, 2};
for(i = 0; i < 4; i++)
{
printf("The whole arrays address is %p , the address of each element is %p\n",data,data[i] );
}
}
/*output:The whole arrays address is 0033FB88 , the address of each element is 00000004
The whole arrays address is 0033FB88 , the address of each element is 00000003
The whole arrays address is 0033FB88 , the address of each element is 00000000
The whole arrays address is 0033FB88 , the address of each element is 00000002*/
But does the structure on the machine addressable as one word?
Say in this example below, would struct id john have its own address..
#include <stdio.h>
#include <string.h>
#define MAX 999
struct id{
char name[20];
int age;
} john;
And is far is pointer go they don't have an address unless pointed to directly to an data type or object type(address) or dynamically allocated with malloc. So does technically does that mean a pointer is not a word on the machine, when just declared only?
thanks, for any input, I am just a begineer and this c by discovery book doesn't actually tell you much about what is going on in the ram with words...