Data SegmentsLast Updated : 17 Mar 2025 To understand the way our C program works, we need to understand the arrangement of the memory assigned to our program. All the variables, functions, and data structures are allocated memory into a special memory segment known as Data Segment. The data segment is mainly divided into four different parts which are specifically allocated to different types of data defined in our C program. ![]() The parts of Data segments are : 1. Data AreaIt is the permanent memory area. All static and external variables are stored in the data area. The variables which are stored in the data area exist until the program exits. 2. Code AreaIt is the memory area which can only be accessed by the function pointers. The size of the code area is fixed. 3. Heap AreaAs we know that C supports dynamic memory allocation. C provides the functions like malloc() and calloc() which are used to allocate the memory dynamically. Therefore, the heap area is used to store the data structures which are created by using dynamic memory allocation. The size of the heap area is variable and depends upon the free space in the memory. 4. Stack AreaStack area is divided into two parts namely: initialize and non-initialize. Initialize variables are given priority than non-initialize variables.
Next TopicFlow of C Program |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India
