public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Dynamic malloc problem
@ 2000-01-01 10:05 clifford.smith
  2000-01-01 23:26 ` Johnny Favorite (it means "Writhing Tentacle of Death")
  2000-04-01  0:00 ` clifford.smith
  0 siblings, 2 replies; 8+ messages in thread
From: clifford.smith @ 2000-01-01 10:05 UTC (permalink / raw)
  To: help-gcc

Hello,

I am writing a chess prog and I have the following problem:

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 ?

Thanks,
serge;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dynamic malloc problem
  2000-01-01 10:05 Dynamic malloc problem clifford.smith
@ 2000-01-01 23:26 ` Johnny Favorite (it means "Writhing Tentacle of Death")
  2000-01-02 11:29   ` clifford.smith
  2000-04-01  0:00   ` Johnny Favorite (it means "Writhing Tentacle of Death")
  2000-04-01  0:00 ` clifford.smith
  1 sibling, 2 replies; 8+ messages in thread
From: Johnny Favorite (it means "Writhing Tentacle of Death") @ 2000-01-01 23:26 UTC (permalink / raw)
  To: help-gcc

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dynamic malloc problem
  2000-01-01 23:26 ` Johnny Favorite (it means "Writhing Tentacle of Death")
@ 2000-01-02 11:29   ` clifford.smith
  2000-01-02 12:50     ` Maurice Fox
  2000-04-01  0:00     ` clifford.smith
  2000-04-01  0:00   ` Johnny Favorite (it means "Writhing Tentacle of Death")
  1 sibling, 2 replies; 8+ messages in thread
From: clifford.smith @ 2000-01-02 11:29 UTC (permalink / raw)
  To: help-gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Thanks for your help, I am pretty sure that there is no bugs, but let me
check ...

Serge

Johnny Favorite (it means "Writhing Tentacle of Death") a écrit dans le
message < 84mrvu02k3p@enews2.newsguy.com >...
>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.
>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dynamic malloc problem
  2000-01-02 11:29   ` clifford.smith
@ 2000-01-02 12:50     ` Maurice Fox
  2000-04-01  0:00       ` Maurice Fox
  2000-04-01  0:00     ` clifford.smith
  1 sibling, 1 reply; 8+ messages in thread
From: Maurice Fox @ 2000-01-02 12:50 UTC (permalink / raw)
  To: help-gcc

On Sun, 2 Jan 3900 20:21:38, "clifford.smith" 
<clifford.smith@libertysurf.fr> wrote:

> Thanks for your help, I am pretty sure that there is no bugs, but let me
> check ...
> 
Famous Last Words # 1!  ;-)

Maurice

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Dynamic malloc problem
  2000-01-01 10:05 Dynamic malloc problem clifford.smith
  2000-01-01 23:26 ` Johnny Favorite (it means "Writhing Tentacle of Death")
@ 2000-04-01  0:00 ` clifford.smith
  1 sibling, 0 replies; 8+ messages in thread
From: clifford.smith @ 2000-04-01  0:00 UTC (permalink / raw)
  To: help-gcc

Hello,

I am writing a chess prog and I have the following problem:

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 ?

Thanks,
serge;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dynamic malloc problem
  2000-01-02 12:50     ` Maurice Fox
@ 2000-04-01  0:00       ` Maurice Fox
  0 siblings, 0 replies; 8+ messages in thread
From: Maurice Fox @ 2000-04-01  0:00 UTC (permalink / raw)
  To: help-gcc

On Sun, 2 Jan 3900 20:21:38, "clifford.smith" 
<clifford.smith@libertysurf.fr> wrote:

> Thanks for your help, I am pretty sure that there is no bugs, but let me
> check ...
> 
Famous Last Words # 1!  ;-)

Maurice

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dynamic malloc problem
  2000-01-01 23:26 ` Johnny Favorite (it means "Writhing Tentacle of Death")
  2000-01-02 11:29   ` clifford.smith
@ 2000-04-01  0:00   ` Johnny Favorite (it means "Writhing Tentacle of Death")
  1 sibling, 0 replies; 8+ messages in thread
From: Johnny Favorite (it means "Writhing Tentacle of Death") @ 2000-04-01  0:00 UTC (permalink / raw)
  To: help-gcc

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Dynamic malloc problem
  2000-01-02 11:29   ` clifford.smith
  2000-01-02 12:50     ` Maurice Fox
@ 2000-04-01  0:00     ` clifford.smith
  1 sibling, 0 replies; 8+ messages in thread
From: clifford.smith @ 2000-04-01  0:00 UTC (permalink / raw)
  To: help-gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Thanks for your help, I am pretty sure that there is no bugs, but let me
check ...

Serge

Johnny Favorite (it means "Writhing Tentacle of Death") a écrit dans le
message < 84mrvu02k3p@enews2.newsguy.com >...
>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.
>
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-01 10:05 Dynamic malloc problem clifford.smith
2000-01-01 23:26 ` Johnny Favorite (it means "Writhing Tentacle of Death")
2000-01-02 11:29   ` clifford.smith
2000-01-02 12:50     ` Maurice Fox
2000-04-01  0:00       ` Maurice Fox
2000-04-01  0:00     ` clifford.smith
2000-04-01  0:00   ` Johnny Favorite (it means "Writhing Tentacle of Death")
2000-04-01  0:00 ` clifford.smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).