On Nov 14, 2007 3:06 PM, Chandrakant Tiwari <[EMAIL PROTECTED]> wrote:

> I am stuck up with a problem with realloc.
>
> actually I am trying to reallocate an statically allocated array ( using
> fortran code) using realloc in C.
> means I pass the few statically allocated arrays from fortran to C code and
> in C code I reallocate all the arrays using realloc and return its pointers
> back to fortran...
>
> now the problem is it works for few records and after certain records it
> produces core dump, unfortunately I can't see the core dump file... and if I
> debug the code of C & fortran usind gdb it works fine...
>
> Please let me know if I am mistaking some where... any help in this would
> highly appriciated..

You can only use realloc() on a pointer returned from malloc(). Any
other use results in undefined behaviour (which you are seeing as
'core dump' and 'works sometimes')


-- 
PJH
"Statistics are like a bikini. What they reveal is suggestive, but
what they conceal is vital"
-- Aaron Levenstein

Reply via email to