Ok I asked this the other day. But the answers I recieved when asked made me realize I was not fit to question it yet until I did some hard research.
So here I am yet again to retry this....
In examples of malloc I seen something as such...
#include <stdio.h>
int main()
{
int ptr_doe;
ptr_doe = (int *) malloc(sizeof(int));
}
I read that it was not neccesary for the:
(this *) malloc(sizeof(int));
And that only
(int *) malloc(sizeof(\\this));
is neccesary. Is the casting before calling the malloc function ever neccesary? And how do we know how much memory we need to allocate and what the hell is this?
malloc(10 * sizeof(int));
is it multiplying 4 bytes by 10? and when is it neccesary to use malloc? How does it work internally? Thanks for any help guys