- #include <stdio.h>
- #include <stdlib.h>
- typedef struct _my{
- char a;
- int b[]; //动态数组
- } my;
- int main()
- {
- int c = 5; //变量
- my *p;
- printf("struct size %d %d\n",sizeof(my),sizeof(int));
- p = (my*)malloc(sizeof(my) + c * sizeof(int)); //内存空间申请
- return 0;
- }