| 
#include <stdio.h>
#include <string.h>
 #include <stdlib.h>
 
 #define LINE 81
 #define MAX 100
 
 void main()
 {
 char temp[LINE];
 char *ps[MAX];
 int index=0;
 int count;
 char *malloc();
 
 puts("Name some anything.");
 puts("Enter them ont at a time; [enter] at the start");
 puts("of a line to end your list. Okay, I'm ready.");
 
 while(index<MAX && gets(temp)!=0 && temp[0]!='\0')
 {
 if((ps[index] = malloc (strlen(temp)+1))==NULL)  // Extra parameter in call to malloc()
 {
 printf("Out of Memory \n");
 exit(0);
 }
 strcpy(ps[index],temp);
 if(++index<MAX)
 printf("That's %d, Continue.\n",index);
 }
 
 puts("Okay, here is what I've got.");
 for(count=0; count<index;count++)
 puts(ps[count]);
 }
 
 이상하게도 malloc()함수만 들어가면 Extra parameter call 에러가 납니다.
 터보씨 3.1윈도우용 버전이고 윈도우 xp 입니다..
 
 ps[index]=malloc(strlen(temp)+1);
 
 이문장이 잘못된건가여??
 가르침 부탁드립니다~~
 |