I came to know the concept of malloc in C, but syntax somewhat confusing. Can some one explain following syntax step by step?
data_type *ptr;
ptr=(data_type*)malloc(size in bytes);
*ptr=some_value;
What is i understood is: First we declare a pointer, which is still pointing nowhere. Then the pointer, not the content but the pointer itself is equal to a pointer type that contains the memory address space for an data_type.
Can some one expand (or clear) my statement to understand better?