C Beginner question: Pointer arithmetic > cleaning up once you are done -
i'm getting hang of pointers. there still questions have.
is possible cause memory leaks when using pointer arithmetic because shifting actual position of pointer pointing to?
i mean, if count upwards copy string char char, need count down c "knows" pointer used point to?
thanks frank
a memory leak possible when using malloc()
or similar functions , not calling free()
when it's needed. free()
should called pointer returned malloc()
, yes if this:
int* ptr = malloc(sizeof(int)); free(ptr + 1);
causes undefined behaviour. memory leak, maybe segmentation fault, possible.
Comments
Post a Comment