Memory Layout in C Programming सी प्रोग्रामिंग में मेमोरी लेआउट
When a C program runs, memory is divided into different sections called memory segments.
जब कोई C program execute होता है तब memory विभिन्न sections में विभाजित होती है जिन्हें memory segments कहा जाता है।
Main Memory Segments मुख्य मेमोरी सेग्मेंट्स
1. Text Segment
Stores executable program code.
यह executable program code store करता है।
2. Data Segment
Stores initialized global and static variables.
यह initialized global तथा static variables store करता है।
3. BSS Segment
Stores uninitialized global and static variables.
यह uninitialized global तथा static variables store करता है।
4. Heap Segment
Used for dynamic memory allocation using malloc() and calloc().
यह malloc() तथा calloc() द्वारा dynamic memory allocation के लिए उपयोग होता है।
5. Stack Segment
Stores local variables and function calls.
यह local variables तथा function calls store करता है।
Memory Layout Diagram
-----------------
| Stack |
-----------------
| Heap |
-----------------
| BSS Segment |
-----------------
| Data Segment |
-----------------
| Text Segment |
-----------------Understanding memory layout is important for pointers, recursion, memory management, and system programming.
Memory layout को समझना pointers, recursion, memory management तथा system programming के लिए अत्यंत महत्वपूर्ण है।
Comments
Post a Comment