Skip to main content

when memory is allocated in c?

when is memory allocated in c?

In this post explaining when is memory allocated for variable in c.

The data and code segments are of fixed size. When a program is compiled, at that point itself, the sizes required for the segments are fixed and known. Hence, they are known as static segments. The sizes of the stack and heap areas are not known when the program gets compiled. Also, it is possible to change or configure the sizes of these areas (i.e., increase or decrease). So, these are called dynamic segments.
Let’s look at each of these segments in detail.
Data and text are stored and created(allocated) at compile time.
Heap and stack are allocated at run time.
refer how memory is allocating, in my previous post  memory allocation in c.

Comments

Popular posts from this blog

CAN INTERVIEW QUESTIONS

Qualifiers and Modifier in C

RTOS Real time operating system interview questions

CAN INTERVIEW QUESTIONS 2

What is UDS protocol

Memory mapping in c

TOP IOT PLATFORMS