...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdlib.h> typedef struct gadget gadget; struct gadget { int i; double d; char *p; }; typedef struct widget widget; struct widget { char *q; int j; double e; }; struct gadget *gp; struct widget *wp; /* ... */ wp = (struct widget *)realloc(gp, sizeof(struct widget)); if (wp->j = 12) { /* ... */ } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdlib.h> #include typedef struct gadget gadget;<string.h> struct gadget { int i; double d; char *p; }; typedef struct widget widget; struct widget { char *q; int j; double e; }; struct gadget *gp; struct widget *wp; /* ... */ wp = (struct widget *)realloc(gp, sizeof(struct widget)); memset(wp, 0, sizeof(struct widget)); /* ... */ if (wp->j = 12) { /* ... */ } |
...