The changes you make to passed_ptr inside the function will not be visible outside the function. You need to pass a pointer to the pointer to be able to make changes that are visible to the caller.
Example:
#include <stdbool.h>
#include <stddef.h>
// Both the pointer and the size arguments are here pointers to the variables
// used to call the function:
bool grow_int_arr(int **passed_ptr, size_t *size)
{
size_t new_size = *size * 15 / 10; // calculate new size
// don't assign directly to `*passed_ptr` - realloc may fail:
int *new_ptr = realloc(*passed_ptr, new_size * sizeof *new_ptr);
if(new_ptr) { // success, now assign:
*passed_ptr = new_ptr;
*size = new_size;
return true;
}
return false; // realloc failed
}
You could now call the function like so:
void parent_func()
{
size_t size = 10;
int *ptr = malloc(size * sizeof *ptr);
if(ptr) {
if(grow_int_arr(&ptr, &size)) { // pass in pointers to the variables
printf("new size: %zu\n", size);
} else {
puts("realloc failed but ptr + size are still valid");
}
free(ptr);
} else {
puts("malloc failed");
}
}