I'm trying to understand a code on list simply chained. The function InserirInicio
is set to Nodo **inicio, float dado
. I could not understand the use of two asterisks in the parameter in this function in specific, would be function requesting a pointer pointer?
Struct and function:
typedef struct nodo
{
float dado;
struct nodo *proximo;
} Nodo;
int InserirInicio(Nodo **inicio, float dado) {
Nodo *nodo;
if ((nodo = (Nodo *) malloc(sizeof(Nodo))) == NULL)
return 0;
nodo->dado = dado;
nodo->proximo = NULL;
if (*inicio != NULL)
nodo->proximo = *inicio;
*inicio = nodo;
return 1;
}
Function call:
int main()
{
int i;
Nodo *inicio = NULL;
for(i = 0; i < 8; i++)
{
InserirInicio(&inicio, i * 15.0);
}
return(0);
}