c - expected identifier before token ( -


i keep getting error

error: expected identifier before ‘(’ token          if((familia->(hijos+i)->edad)>18)                         ^ 

i can't solve it, problem in familia-> don't know how fix it. these structs using, think should enough understand :(

  typedef struct hijo{      int va_a_la_escuela;      int edad;      int estavacunado;                } hijo;   typedef struct gasto{  int vestimenta;  int vivienda;  int comida;      } gasto;   typedef struct familia{    int numero_de_hijos;      hijo* hijos;    gasto* gastos; int recibebono;  int revisada;    } familia;   int verificarvacuna(familia* familia){       int i;       (i = 0; < familia->numero_de_hijos; i++) {         if(familia->(hijos+i)->estavacunado==0)//line of error           return 0;       }      return 1;     }   //verificacion de edad de hijos de la familia int verificaredad(familia* familia){   int i;   (i = 0; < familia->numero_de_hijos; i++) {     if(familia->(hijos+i)->edad>18) //line of error       return 0;   }  return 1; } 

  • i assume in familia->hijos, hijos array, maybe mean

    familia->hijos[i].estavacunado 
  • or meant use pointer arithmetic, can be

    (familia->hijos + i)->estavacunado 
  • or if it's array of pointers

    familia->hijos[i]->estavacunado 
  • or array of pointers, using pointer arithmetic

    (*(familia->hijos + i))->estavacunado 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -