Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!ich From: ich@unix.cis.pitt.edu (Il-hyung Cho) Newsgroups: comp.lang.c Subject: callocing 2D array Message-ID: <122085@unix.cis.pitt.edu> Date: 30 Apr 91 02:04:26 GMT Reply-To: ich@unix.cis.pitt.edu (Il-hyung Cho) Distribution: usa Organization: Univ. of Pittsburgh, Comp & Info Sys Lines: 24 Hello, guys. I'm not quite good at C, but I hope some of you could help my problem. I'm trying to implement 2D array whose size is not known until run time. The way I tried was like follows: --------------------------------------------------------------- typedef int **ary; main() { int **i; i = (ary) calloc(25, sizeof(int)); i[0[0] = 1; /* Segmentation falut */ } ------------------------------------------------------------------ As indicated, the array cannot be assigned any value. How do I solve the problem? I'll really appreciate any of your help. Thanks. PS> If you are willing to help me, please email me. Thanks a bunch.