assignment from incompatible pointer type



  • Hallo,

    warum kommt bei folgendem Code in Zeile 23 die o.g. Warnung und wie macht man es besser?

    typedef struct s_mat
    {
      long **entry;
      //[...]
    }
    *mat;
    
    typedef struct s_la
    {
      mat *am;
      //[...]
    }
    *la;
    ________________________________________________________
    
    la M;
    long **a;
    long count;
    
    //[...]
      a = calloc (count, sizeof(long**));
      for (i=0; i < count; i++)
        a[i] = M->am[i]->entry;
    //[...]
    


  • a[i] ist nur noch vom Typ long * , entry ist vom Typ long **

    Einfaches Bsp.:
    Bei char *c ist dann c[0] vom typ char



  • Ja, natürlich. Ich hatte den zusätzlichen Pointerpunkt vergessen.
    Danke für die Antwort. 🙂

    Jetzt habe ich also

    long **a;
    

    zu

    long ***a;
    

    abgeändert, aber erhalte immer noch die gleiche Fehlermeldung an derselben Stelle. 😕


Anmelden zum Antworten