Dynamic Memory Allocation 
Author Message
 Dynamic Memory Allocation



: >>        I am writing a Finite Element program using a Turbo C++ compiler
: >>version 3.0 (Borland). I have initiated a lot of dynamic two dimensional
: >>arrays in my program using malloc() & calloc() functions.  I am certain the
: >>syntax is correct.  However, the program hangs after one such initiation
: >>(not the first though) DURING execution.
: >
: <snip>
: >However even so a correctly written program shouldn't "hang". If you are
: >calling malloc/callc correctly and testing the return value for failure
: >(which you should *always* do) then your should at least be able to detect
: >an allocation problem ans shut down cleanly.

: Make sure to #include the necessary header files for correct behavior.
: #include <stdlib.h>

: --
: Scott Allen            

--
**************begin r.s. response******************

        why mix
                malloc()
        and
                calloc()
        calls ?
        ...
        ( last i looked ... )
        such use subtly different argument
        lists
        !!!

        ? certain that arguments are
        appropriately different for these
        two types of calls ???

**************end r.s. response********************
Ralph Silverman



Fri, 27 Aug 1999 03:00:00 GMT  
 Dynamic Memory Allocation



Quote:
>        why mix
>                malloc()
>        and
>                calloc()
>        calls ?

You use calloc() when you need zero'd memory, malloc() when you don't.

Quote:
>        ...
>        ( last i looked ... )
>        such use subtly different argument
>        lists
>        !!!

True, you have to call them slightly differently but other than zeroing
memory they do essentially the same thing.

--
-----------------------------------------


-----------------------------------------



Sun, 29 Aug 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. TeX, Pascal/VS, dynamic memory allocation, and so forth

2. Forth dynamic memory allocation - wanted

3. New Forther trying to implement dynamic memory allocation

4. Dynamic Memory Allocation

5. best dynamic memory allocation in f77?

6. dynamic memory allocation

7. Dynamic memory allocation

8. Dynamic memory allocation with Ada83

9. dynamic memory allocation

10. Dynamic Memory Allocation

11. dynamic memory allocation

12. VHDL model with dynamic memory allocation

 

 
Powered by phpBB® Forum Software