Complete the allocate_int function on the next slide. It accepts a pointer to a pointer to an integer called pointer_pointer, and a raw value. Change the value of pointer_pointer's pointer's address to point to new memory that has the value of the int.
void allocate_int(int **pointer_pointer, int value)
{
}
This function correctly allocates an array of token pointers on the heap, but notice that the addresses it's adding to each index are the addresses of the stack-allocated inputs.
token_t** create_token_pointer_array(token_t* tokens, size_t count)
{
token_t** token_pointers = malloc(count * sizeof(token_t*));
if (token_pointers == NULL)
{
exit(1);
}
for (size_t i = 0; i < count; ++i) {
token_pointers[i] = &tokens[i];
}
return token_pointers;
}