What is data segment?

Answer:Segment number 8 has special name which is known as data segment. It has divided into four parts.
1. Stack area:- All automatic variables are created into stack area.Default storage class of any local variable is auto.This variable may be int, char, float, array, pointer, struct, union etc.It also return function argument and return address.It follow LIFO data structure. It has two part one for initialize variable another for non-initialize variable.All initialize variable are more nearer than uninitialized variable and vice versa. 2. Data area : All static and extern variable are created in the data area. 3. Heap area: Malloc and calloc always allocate memory in the heap area.It is used for dynamic memory allocation.It’s size depends upon free space in the memory. 4. Code area: Function pointer can only access code area.Size of this area is always fixed and it is read only area.

8 comments:

Anonymous said...

ok thank you now i know about data segment

dinhpq said...

Thank you so much.

jailani said...

oh good knowledge is wealth

Nil said...

Very nice & useful explanation....

Anonymous said...

dude pls dont close this site..useful

Nitesh goyal said...

All initialize variable are more nearer than uninitialized variable and vice versa.
nearer???????

Janakiraman K said...

oh thanx...

Ashish8109 said...

can any one explain me about code area..? how function pointer only can access this area..?