This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Dynamic malloc problem
- To: help-gcc at gnu dot org
- Subject: Re: Dynamic malloc problem
- From: "Johnny Favorite (it means \"Writhing Tentacle of Death\")" <allen at snakebite dot com>
- Date: Sun, 2 Jan 2000 01:38:14 -0500
- Newsgroups: gnu.gcc.help
- Organization: http://extra.newsguy.com
- References: <84lf9k$i7i$1@news4.isdnet.net>
- Xref: wodc7nx0 gnu.gcc.help:2326
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.