Can anyone clearly explain (with examples) why do we have to change the data type of a dynamic allocation pointer from the default void type into the same data type of its corresponding pointer variable?
ex:
int *ptr = (int *)malloc(sizeof(int));
Can anyone clearly explain (with examples) why do we have to change the data type of a dynamic allocation pointer from the default void type into the same data type of its corresponding pointer variable?
ex:
int *ptr = (int *)malloc(sizeof(int));