Function malloc() is used to dynamically allocate the memory in C. The general syntax goes the following way:
(type_casting) malloc (size)
let us understand it in detail in the form of a conversation:


Thatβs how the components of the syntax:
β(type casting the pointer) malloc(specifying the size) β
can be understood.
A sample source code can be seen below: