I have this structure:
typedef struct nodo{
int dato;
struct nodo *izq;
struct nodo *der;
}nodo;
typedef struct nodo *avl;
I have this method:
void insertar(avl *r, int dato){
if (*r==NULL){
*r=(nodo*)malloc(sizeof(nodo));
(*r)->dato=dato;
(*r)->izq=NULL;
(*r)->der=NULL;
All this code works perfectly. My question is about the line:
*r=(nodo*)malloc(sizeof(nodo));
Why I have to put * on the right side of the name of the type of data??
Why it doesn't work with:
*r=(*nodo)malloc(sizeof(nodo));