#include #include #include #define MAX_ARRAY 10 struct mycomplex { int re; int im; }; typedef struct mycomplex cplx; struct other { cplx *c; }; int myf2(int *p); int myf(int* p) { myf2(p); //notexist(p); } int myf2(int *p) { int a = 20; *p = 10; a = *p + 10; printf("%d\n", a); } int main() { int *arr = (int*)malloc(sizeof(int) * MAX_ARRAY); int i1 = 5; for (int i = 0; i < MAX_ARRAY; i++) { arr[i] = i; printf("%d ", arr[i]); } printf("\n"); free(arr); cplx *pc = (cplx*)malloc(sizeof(cplx) * 20); // memset(pc, 0, sizeof(cplx) * 20); printf("%d \n", pc[0].im); struct other *o = (struct other*)malloc(sizeof(struct other) * 20); memset(o, 0, sizeof(struct other) * 20); pc[0].re = 1; pc[0].im = 2; o[0].c = (cplx*)malloc(sizeof(cplx)); printf("%d \n", o[0].c->im); free(o[0].c); free(o); myf(&i1); printf("i %lu\n", sizeof(int)); printf("f %d\n", sizeof(float)); printf("d %d\n", sizeof(double)); printf("cplx %d\n", sizeof(cplx)); printf("void* %d\n", sizeof(void*)); return 0; }