Wednesday, November 28, 2018

Structure and Union and Memory Allocation


Structure Defination:
            a data type to store group of data with various of data type
Syntax:
struct name_structure {
    dataType1 name_field1;
    dataType2 name_field2;
   
};

Union Defination:
Union is used for memory join. By using union, a memory location can be assigned for two or more variable with different data types
Syntax:
union  name_union{
     typedata1  name_var1 ;
     typedata2   name_var2;
     ……
} name_var_union;

Union Containing:
 name_union   name_var_union; 


Memory Allocation Defination:
acquiring some memory space (RAM) managed by the OS to be used by a program.

Memory de-allocation Defination
            releasing memory space (RAM) back to the OS.


 Albert TG/2201736385/LB04
Binusian 2022





No comments:

Post a Comment