1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <memory.h> typedef struct NODE { int data; struct NODE* link; } NODE; int main(void) { NODE* p1; p1 = (NODE*)malloc(sizeof(NODE)); p1->data = 1; p1->link = NULL; NODE* p2; p2 = (NODE*)malloc(sizeof(NODE)); p2->data = 2; p2->link = NULL; NODE* p3; p3 = (NODE*)malloc(sizeof(NODE)); p3->data = 3; p2->link = NULL; p1->link = p2; p2->link = p3; free(p1); free(p2); free(p3); return 0; } | cs |