its member, if I want to realloc the space of x & increase its size.
Then I should realloc(abc, size) or realloc(abc->x,size)?
I m asking this becasuse I'm getting realloc(): invalid pointer when i did realloc on (abc->x,size)
For realloc() to work, it has to be previously allocated by malloc(), calloc() and realloc(). and realloc(abc->x, size) is correct. You are allocating size for x, you need to pass it for it to work. Share your code so we can know why it throws invalid pointer error.
Обсуждают сегодня