From: "Chewbaklava" Newsgroups: comp.os.msdos.djgpp Subject: Implicit declaration Lines: 64 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: Date: Wed, 16 Feb 2000 17:32:50 -0500 NNTP-Posting-Host: 209.222.102.97 X-Trace: harpo 950740472 209.222.102.97 (Wed, 16 Feb 2000 17:34:32 EST) NNTP-Posting-Date: Wed, 16 Feb 2000 17:34:32 EST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I have a rather simple program, it opens a fil, reads some stuff, allocates 2 arrays with malloc, and then prints them out and frees the arrays. The problem is, I get 2 error messages that, of course may be nothing, but may be a problem waiting to happen. code: #include int main() { FILE *file; int num_maps; char map_name[64]; int width; int height; int i; int *map; int *props; if ((file = fopen("mike.dat", "r+")) == NULL) { printf("Error opening mike.dat"); return 1; } fscanf(file, "%d", &num_maps); fscanf(file, "%d", &width); fscanf(file, "%d", &height); fseek(file, 1, SEEK_CUR); fgets(map_name, 64, file); map = (int *) malloc((width * height * sizeof(int))); <<-- Warning here props = (int *) malloc((width * height * sizeof(int))); for ( i = 0; i < (width * height); i++) fscanf(file, "%d %d", &map[i], &props[i]); printf("\n%d", num_maps); printf("\n%d", width); printf("\n%d", height); printf("\n%s\n\n", map_name); for (i = 0; i < (width * height); i++) printf("%d %d\n", map[i], props[i]); printf("%s\n\n", map_name); fclose(file); printf("%s\n\n", map_name); free(map); printf("%s\n\n", map_name); free(props); <<-- Wanrning here printf("%s\n\n", map_name); return 0; } I am running this on a 486Dx2 66Mhz with 16MB RAM. - Chewbaklava The honorable wookie presiding