#include
#include
void main() {
char *s[10];
int i;
for (i = 0;i < 10;i++)
{
if ((s[i] = (char *)malloc(128)) == NULL)
printf("\nerror\n");
exit(0);
}
for (i = 0;i < 10;i++) {
printf("\ns[%i}=%x", i, s[i]);
free(s[i]);
}
getch();
system("pause");
}
#include <conio.h>
#include <stdlib.h>
#include<stdio.h>
void main()
{
char *s[10];
int i;
for (i = 0;i < 10;i++)
{
if ((s[i] = (char *)malloc(128)) == NULL)
{//加个大括号
printf("\nerror\n");
exit(0);
}//加个大括号
}
for (i = 0;i < 10;i++) {
printf("\ns[%i}=%x", i, s[i]);
free(s[i]);
}
getch();
system("pause");
}
that's all right!Thanks!