- Platform: Linux 3.2.0 x86 (Debian Wheezy)
- Compiler: GCC 4.7.2 (Debian 4.7.2-5)
I am wondering what will happen if I attempt to realloc() a pointer that has been incremented. For example
char *ptr = NULL;
size_t siz = 256;
ptr = malloc(siz);
ptr = realloc(ptr + 5, siz * 2);
What will the return value of the realloc()
call be? I also know that realloc()
's documentation states that the pointer passed to it must have been returned by malloc(), calloc()
, or realloc()
. I am assuming that means I cannot realloc()
an incremented pointer but I have been unable to verify that assumption.