/* * dynamic allocation of structures */ #include #include struct rec { int i; float f; char c; }; int main(void) { struct rec *p; p = (struct rec *) malloc (sizeof(struct rec)); /* order of operations ! */ (*p).i = 10; (*p).f = 3.14; (*p).c = 'a'; printf("%d %f %c\n",(*p).i,(*p).f,(*p).c); free(p); return 0; }