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.
Post a Comment