Content deleted Content added
m C -- changed wikilink to more stable article |
m C -- added wikilinks for heap |
||
Line 136:
[[File:Computer-memory-map.png|thumb|right|Computer memory map]]
''C'' allows the programmer to control which region of memory data is to be stored. ''Global variables'' and ''static variables'' require the fewest [[Clock signal|clock cycles]] to store. The [[call stack|stack]] is automatically used for the standard variable [[Declaration (computer programming)|declarations]].
* The ''global and static data'' region is located just above the ''program'' region. (The program region is technically called the ''text'' region. It's where machine instructions are stored.)
Line 169:
:* ''Local variables'' declared using the <code>static</code> prefix are also stored in the ''global and static data'' region.<ref name="geeksforgeeks"/> Unlike global variables, static variables are only visible within the function or block. Static variables always retain their value. An example usage would be the function <code>int increment_counter(){ static int counter = 0; counter++; return counter;}</code>
* The
|title=The Linux Programming Interface
|last=Kerrisk
Line 187:
|page=122}}</ref> are called ''automatic variables''<ref name="cpl-ch1-p31"/> and are stored in the stack.<ref name="geeksforgeeks"/> They are visible inside the function or block and lose their scope upon exiting the function or block.
* The
|title=The C Programming Language Second Edition
|last1=Kernighan
|