The following works successfully:
char *op, op_temp;
op = malloc(len+1);
op_temp = op;
op = realloc(op, ++len);
while the following results in a runtime error:
char *op, op_temp;
op = malloc(len+1);
op_temp = op;
op = realloc(op_temp, ++len);
Why so even though the same piece of memory is reallocated?