pointer allocation

Xue Jue xj01+ at andrew.cmu.edu
Mon Dec 19 09:09:18 AEST 1988


I am try to allocate a list of integer pointers by the following short program.
But for some reason, after I compiled it and tried to run, it gave me a
Segmentation fault message. I couldn't see what's wrong there. Could anyone out
there give me some guide?


#include <stdio.h>
int *(*B);

main()
{
 *B = (int *) calloc(18,sizeof(int));
}


By the way, this is on IBM RT work station. The same thing has been running on
IBM PC with microsoft C 5.0.

Thanks.

----jue xue



More information about the Comp.lang.c mailing list