I have some memory questions, indeed some hazy parts to be clarified. My English is not so good so I ll try to explain it.At first where is the memory positions of this variables.
Code: Select all
char Var;
unsigned int *Var1;
unsigned int Var2;
I mean, are they in stack or what decides the memory positions of this variables. For instance are they in my binary code(As I know uninitialized variables dont take part in binary code)?
And their memory layout is another problem. Are their memory positions in the order of they defined? I mean:
Code: Select all
Var--->[0x0050]
Var1-->[0x0050+sizeof(Var)]
Var2-->[0x0050+sizeof(Var)+sizeof(Var1)]
Can I reach addr of 'Var1' from adding sizeof 'Var' to addr of 'Var'?
And a third point, for instance I need an array, an array of 0x1000 char. I decided to put it between 0x1000-0x2000. So in my C code I define this array as a pointer to that area, not as an array. I mean:
not this way, but:
Code: Select all
unsigned char *Var = (unsigned char *)0x1000;
But as I mentioned above, this is an un-initialized variable and so the space is allocated for this array in my mind. Is that couse a problem? I wonder if computer puts another variable to that space before asking me?