All pastes #595278 Raw Edit

plutonas

public c v1 · immutable
#595278 ·published 2007-06-29 12:46 UTC
rendered paste body
 struct qentry *newp1, *newp2; // tia dio nea simeia pou tha prostheso  newp1 = malloc(sizeof(struct qentry *));  newp1->nvertex = malloc(sizeof(struct qentry *));  newp1->pvertex = malloc(sizeof(struct qentry *));  newp2 = malloc(sizeof(struct qentry *));  newp2->nvertex = malloc(sizeof(struct qentry *));  newp2->pvertex = malloc(sizeof(struct qentry *));  //memcpy(newp1, v1, sizeof(struct qentry));   memcpy(newp2, v2, sizeof(struct qentry)); //diplasiazoume ta akra tis diagoniou, ena akro tha pei sto monotono polygono, kai ena sto ypoloipo  //  memcpy(newp1->nvertex, v1->nvertex, sizeof(struct qentry));     *newp1 = *v1;  *(newp1->nvertex) = *(v1->nvertex);  newp1->nvertex->pnt.x = v1->nvertex->pnt.x;    printf("INTERESTING the next vertex of the left one is: %d %d\n", newp1->nvertex->pnt.x, newp1->nvertex->pnt.y);  v1->nvertex->pnt.x = 333333333;    printf("INTERESTING the next vertex of the left one is: %d %d\n", newp1->nvertex->pnt.x, newp1->nvertex->pnt.y);NOTE: the first printf prints the correct value, the second one prints the 3333 thing so newp1 got changed too