Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1566591
  • 博文数量: 354
  • 博客积分: 8137
  • 博客等级: 中将
  • 技术积分: 5137
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-26 15:40
文章分类

全部博文(354)

文章存档

2010年(300)

2009年(54)

分类: C/C++

2010-07-04 23:19:15

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

#define NUM 10

int main()
{
    char *str[NUM];
    int t;

    for(t = 0; t < NUM; t++)
    {
        if((str[t] = (char *)malloc(128)) == NULL)
        {
            printf("Allocation Error.\n");
            exit(1);

        }
    printf("Enter string %d: ", t);
    gets(str[t]);
    }

    for(t = 0; t < NUM; t++)
        free(str[t]);

    return 0;


    system("pause");
    return 0;
}


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