-
8
pages
-
English
-
Documents
Description
|< C & C++ Compiler, Assembler, Linker & Loader | Main | C Storage Class & Memory 2 >| C++/OOP | Site Index | Download | MODULE ZTHE C STORAGE CLASSES, SCOPE AND MEMORY ALLOCATION 1 My Training Period: zz hours Note: gcc compilation examples are given at the end of this Module. C abilities that supposed to be acquired: ▪ Understand and use the auto, register, extern and static keywords.▪ Understand the basic of the process address space.▪ Understand and appreciate the static, automatic and dynamic memory allocations.▪ Understand how the memory is laid out for a running process.▪ Understand and use the malloc(), calloc(), realloc() and free() functions. Z.1 INTRODUCTION ■ The storage class determines the part of memory where storage is allocated for an object (particularly variables and functions) and how long the storage allocation continues to exist.■ A scope specifies the part of the program which a variable name is visible, that is the accessibility of the variable by its name. In C program, there are four storage classes: automatic, register, external, and static.■ Keep in mind that in the hardware terms we have primary storage such as registers, cache, memory (Random Access Memory) and secondary storage such as magnetic and optical disk.Z.1.1 AUTOMATIC VARIABLE - auto■ They are declared at the start of a program’s block such as in the curly braces ( { } ). Memory is ...
-
Publié par
-
Langue
English