Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1021293
  • 博文数量: 297
  • 博客积分: 11721
  • 博客等级: 上将
  • 技术积分: 3431
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-25 10:21
文章分类

全部博文(297)

文章存档

2016年(9)

2011年(71)

2010年(137)

2009年(80)

分类: C/C++

2009-07-24 10:42:06

#include
#include

typedef struct scull_qset {
    void **data;
    struct scull_qset *next;
}scull_qset_t;

int main(int argc,char ** argv)
{
  scull_qset_t * ptr1 =(scull_qset_t *) malloc(sizeof(scull_qset_t));
  int qset= 1000;
  int num = 4000;

  /* alloc one scull_qset */
  ptr1->data = (void **)malloc(qset*sizeof(void *));
  int i;
  for(i=0;i  {
     ptr1->data[i] = (void *)malloc(num*sizeof(char));   
     ptr1->data[i] = "hello world!";  
  }
 
  /* another substitude method.*/
  /*
  void ** pdata ;
  for(pdata=ptr1->data,i=0;i  {
     *pdata = (void *)malloc(num*sizeof(char));  
     *pdata = "hello world!";
  }
  */
  return 0;  
}

阅读(595) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~