mbalves Posted May 1, 2009 at 03:58 AM Report #260463 Posted May 1, 2009 at 03:58 AM Boas, Eu tenho a seguinte estrutura num header file : typedef struct qtnode { struct QTnode *firstChild; struct QTnode *secondChild; struct QTnode *thirdChild; struct QTnode *fourthChild; int xMin; int xMax; int yMin; int yMax; List l; //Lista de Rectangulos inseridos no nó } QTNODE,*QuadTree; No respectivo ficheiro c eu estou a construir uma função onde pretende preencher uma quadtree: void genQuadTree(List lRect, int xMinimum, int xMaximum, int yMinimum, int yMaximum) { QuadTree q = malloc(sizeof(QTNODE)); QTNODE *qFirst = q->firstChild; QTNODE *qSecond = q->secondChild; QTNODE *qThird = q->thirdChild; QTNODE *qFourth = q->fourthChild; o problema é que o compilador diz me que "QuadTree.c:70: warning: initialization from incompatible pointer type" que corresponde aquelas ultimas 4 linhas de codigo. Se me pudessem ajudar a descobrir como poderia resolver o erro agradecia bastante. cumprimentos
Baderous Posted May 1, 2009 at 12:00 PM Report #260491 Posted May 1, 2009 at 12:00 PM Como não estás a fazer casting do resultado do malloc para QuadTree, ele devolve void*, que é incompatível com QuadTree.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now