Chinaunix首页 | 论坛 | 博客
  • 博客访问: 441253
  • 博文数量: 88
  • 博客积分: 2677
  • 博客等级: 少校
  • 技术积分: 893
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-13 08:01
文章分类

全部博文(88)

文章存档

2017年(3)

2016年(1)

2012年(4)

2011年(4)

2010年(57)

2009年(19)

我的朋友

分类: C/C++

2011-12-08 08:29:58

  1. #include <stdio.h>
  2. #include <stdlib.h>

  3. typedef struct _my{
  4.   char a;
  5.   int b[]; //动态数组
  6. } my;

  7. int main()
  8. {
  9.     int c = 5;  //变量
  10.     my *p;
  11.     printf("struct size %d %d\n",sizeof(my),sizeof(int));
  12.     p = (my*)malloc(sizeof(my) + c * sizeof(int)); //内存空间申请

  13.    return 0;
  14. }
阅读(1865) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~