From: Eab AT salnet DOT org Message-Id: <199811052339.SAA21629@delorie.com> To: djgpp AT delorie DOT com Date: 5 Nov 1998 17:35:00 CST Subject: Why won't this program run? MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="zzzz726d825658c60salnet.orgzzzz" Reply-To: djgpp AT delorie DOT com > If you are reading this text, then your mail reader does not support > the MIME (Multipurpose Internet Mail Extensions) standard. To take > full advantage of the features of this message, you need to upgrade > your mailer to a MIME V1.0 compliant package. Some parts of this > message may be in human readable form. --zzzz726d825658c60salnet.orgzzzz Content-Type: text/plain Content-Transfer-Encoding: 7bit I've been having some trouble. The attached C source file compiled, but the instant I attempt to run it, it quits. Does anybody have any ideas as to why I'm having trouble? Ethan Bowker eab AT salnet DOT org --zzzz726d825658c60salnet.orgzzzz Content-Type: text/plain; name="call.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="call.c" #include #include #include #define LAST -1 struct person { char *name; int call1, call2; } *people; int calc(int index, int num) { if(people[index].call1!=LAST) num=calc(people[index].call1,num+1); else num++; if(people[index].call2!=LAST) num=calc(people[index].call2,num+1); else num++; return num; } int main() { char **input; char name[20]; char *tok; int i, j, done=0, numlines=10; input=(char **)malloc(10); puts("Enter data:\n"); for(i=0,done=0;!done;i++) { if(i==numlines) if(realloc(&input,numlines+=10)==NULL) { puts("Not enough memory!\n"); return 1; } if((input[i]=(char *)malloc(20))==NULL) { puts("Not enough memory!\n"); return 1; } gets(input[i]); if(input[i][0]=='.') done=-1; } free(input[i]); realloc(&input,i-1); numlines=i-1; printf("Enter person: "); gets(name); if((people=malloc(sizeof(struct person)*numlines))==NULL) { printf("Not enough memory!\n"); return 1; } for(i=0;i