From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Johnny Favorite (it means \"Writhing Tentacle of Death\")" To: help-gcc@gnu.org Subject: Re: Dynamic malloc problem Date: Sat, 01 Jan 2000 23:26:00 -0000 Message-id: <84mrvu02k3p@enews2.newsguy.com> References: <84lf9k$i7i$1@news4.isdnet.net> X-SW-Source: 2000-01/msg00003.html clifford.smith wrote: > sine I allocate memory with malloc for table in the main() it > works perfectcly. As soon as I try to allocate this memory in > a function (void my_funct() ... ) I get a segm. fault. > > What can I do. Is there another way to dynamicaly allocate mem ? The fault is in your code. There is absolutely no reason why you shouldn't be able to malloc() in a function other than main(). Look for bugs. From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Johnny Favorite (it means \"Writhing Tentacle of Death\")" To: help-gcc@gnu.org Subject: Re: Dynamic malloc problem Date: Sat, 01 Apr 2000 00:00:00 -0000 Message-ID: <84mrvu02k3p@enews2.newsguy.com> References: <84lf9k$i7i$1@news4.isdnet.net> X-SW-Source: 2000-q1/msg00003.html Message-ID: <20000401000000.bDv1RpwzzeQIaHKcng98t7xqPIpCB30SStspelruZ7k@z> clifford.smith wrote: > sine I allocate memory with malloc for table in the main() it > works perfectcly. As soon as I try to allocate this memory in > a function (void my_funct() ... ) I get a segm. fault. > > What can I do. Is there another way to dynamicaly allocate mem ? The fault is in your code. There is absolutely no reason why you shouldn't be able to malloc() in a function other than main(). Look for bugs.