.
: 1) ; 2) ; 3) ; 4) ; 5) .
(small) : , . .
(medium) , , . .
(compact) , , . , , .
(large) , . .
(huge) , , .
.
, extern static. . , . .
, - , , , .
, .
( ) .
++ : malloc, calloc, free, realloc.
malloc, , void *, (void *malloc(size_t size)). , 1 000 000 int` :
int * p = (int *) malloc(1000000*sizeof(int)); |
, malloc 0.
free. . free, . free , malloc.
calloc. malloc, ( ) , . ,
|
|
int * q = (int *) calloc(1000000, sizeof(int)); |
q int` .
realloc. . size , , ptr, , .
new delete.
++ new delete.
new:
*_ = new _(). |
new:
int * p = new int[1000000]; // 1000000 int` |
.. new sizeof().
new :
delete [] p; |
, :
int * q = new int; |
int * q = new int(10); // int 10 |
:
delete q; |
.
, .
( struct), : . . : , . (, ) :
struct Node{ Data d; // Data Node *; }; |