I'm reading an old book called C Traps and Pitfalls by A Koenig, published in 1989, just before the first C standard. In it, I find the code below:
char *r, *malloc();
r = malloc(strlen(s) + strlen(t) + 1);
The first line can't be compiled correctly; I use CodeBlocks with MinGW to compile it, which gives me the following error message:
||=== Build: Debug in beta (compiler: GNU GCC Compiler) ===|
C:\Users\ADMIN\Desktop\beta\beta\main.c||In function 'main':|
C:\Users\ADMIN\Desktop\beta\beta\main.c|9|error: conflicting types for 'malloc'|
C:\Program Files (x86)\CodeBlocks\MinGW\include\stdlib.h|356|note: previous declaration of 'malloc' was here|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I have learnt some C, but I don't know the meaning of "char *malloc()" and why the compiler gives out the error.