Monday, March 7, 2011

Embedded System Training -- Day 2

Embedded System -- Day 2

// Important Program for Volatile
int main()
{

volatile const int x = 10;
int *p = (int *)&x;
*p=20;
printf("%d",x); //if we do not write volatile we will see this as 10 .
printf("%d",*p);

}


Structure:
The Compiler maintains a Structure Defination Table[SDT] which has got offset
name,type,offet
a,char,0
x,double,1
y,char,9
with help of this table, at runtime memory is allocated for structures.

struct student p1;
p1.x = 10;
The address of p1 is resolved using Symbol table and Offset is taken from SDT.

No comments:

Post a Comment