# Memory Allocation :-
- The process of allocating space for variables, array, structure, etc.in memory called as memory allocation.
    There are basically two ways to allocate space in the memory they are :- 
    a.) Static / Compile Time Allocation.            b.)  Dynamic / Run Time Allocation

a.) Static / Compile Time Memory Allocation :-
 -   It is automatically performed by compiler during translation / compilation of programs.
        Example :- int x;  takes 2 bytes or 8 bytes space in memory. 
                           double x;  takes 8 byte space in memory. 
                           float x;  takes 4 bytes space in memory.
                           char x; takes 1 byte space in memory

b.) Dynamic / Run Time Memory Allocation :-
 -   It is the process of allocating space in memory after execution of program that is at run time is known as dynamic memory allocation.
                                    In C language, there are four built functions are used for DMA (Dynamic Memory Allocation) or  DMM  (Dynamic Memory Management).
    
        Following are four built in functions for DMM & DMA :-
           


Note : - Float represents single precision where as double represent whereas double represents double precision.

Note :- For promotion / widering, compiler uses waterfall-fall model.


Example 1:
                 /* Example of implicit type-conversion. */
         #include<stdio.h>
         #include<conio.h>
         void main()
         {
    int x=15;
    double y=10.5;
   printf ("%d",sizeof(x*y));
            getch();
                    }

Example 2:
         /* Example of implicit type-conversion. */
         #include<stdio.h>
         #include<conio.h>
         void main()
         {
    float x=15.23;
    double y=10.75;
   printf ("%d",sizeof(x+y));
            getch();
                    }

Example 3:
         /* Example of explicit type-conversion. */
         #include<stdio.h>
         #include<conio.h>
         void main()
         {
    float x=15.2378;
    int y;
            y=(int)x;
   printf ("%d",y);
            getch();
                    }

Example 4:
         /* Example of explicit type-conversion. */
         #include<stdio.h>
         #include<conio.h>
         void main()
         {
    float x;
    int y=45;
            x=(int)y;
   printf ("%d",x);
            getch();
                    }

# GENERIC / VOID POINTER
A pointer of type void pointer is used for allocating dynamic memory.
Example :  void *p; /* generic pointer. */
        int x=25;
        p=&x;  // valid.
        float y=10.25;
        p=&y;  // valid.
        double z=20.852;
        p=&2; // valid.