-1
The situation is as follows:
I have a struct with a field that is a pointer pointer, however I want to pass as parameter in a function only the pointer pointed, that is, the innermost pointer of that my field in struct:
In code it would be like this:
typdef struct
{
int **ponteiro;
}Ponteiro;
I have the address assignment this way:
grafo->vertices[posicao_B].vertice_adjacente[(grafo->vertices[posicao_B].qtd_adjacentes-1)] = &grafo->vertices[posicao_A]; <-- aqui estou tentando fazer com que o ponteiro de ponteiro (**vertice_adjacente) aponte para o endereço de (&grafo->vertices[posicao_A])
And I’m trying to print it like this, but nothing’s being printed:
printf("Vertice adjacente de A %d\n",(grafo->vertices[posicao_A].vertice_adjacente[0]->num_vertice));
Just remembering that (vertice_adjacent) is an array of pointers dynamically allocated by a function I developed.
If you can help me, I’d appreciate it!
Give more context on how you’re using this code.
– Maniero
In case, you’re wanting to pass
int **ponteiro
as a parameter or the first pointer ofint **ponteiro
, that would beint *ponteiro
?– regmoraes