Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Corrected your wrong sentences</p> <pre><code>constant data types -----&gt; code //wrong </code></pre> <p>local constant variables -----> stack </p> <p>initialized global constant variable -----> data segment</p> <p>uninitialized global constant variable -----> bss</p> <pre><code>variables declared and defined in main function -----&gt; heap //wrong </code></pre> <p>variables declared and defined in main function -----> stack</p> <pre><code>pointers(ex:char *arr,int *arr) -------&gt; heap //wrong dynamically allocated space(using malloc,calloc) --------&gt; stack //wrong </code></pre> <p>pointers(ex:char *arr,int *arr) -------> size of that pointer variable will be in stack.</p> <p>Consider that you are allocating memory of n bytes (using <code>malloc</code> or <code>calloc</code>) dynamically and then making pointer variable to point it. Now that <code>n</code> bytes of memory are in heap and the pointer variable requries 4 bytes (if 64 bit machine 8 bytes) which will be in stack to store the starting pointer of the <code>n</code> bytes of memory chunk.</p> <p>Note : Pointer variables can point the memory of any segment.</p> <pre><code>int x = 10; void func() { int a = 0; int *p = &amp;a: //Now its pointing the memory of stack int *p2 = &amp;x; //Now its pointing the memory of data segment chat *name = "ashok" //Now its pointing the constant string literal //which is actually present in text segment. char *name2 = malloc(10); //Now its pointing memory in heap ... } </code></pre> <p>dynamically allocated space(using malloc,calloc) --------> heap</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload