dynamic memory allocation (2)
dynamic memory allocation (2)
Syntax
ptr = (cast_type *) malloc (byte_size);
or
ptr = (void *) malloc (byte_size);
4.realloc( )
realloc( ) stands for reallocation of memory.
Realloc( ) can add or delete the memory which is created by
malloc( ) or calloc( ) while leaving the original content as it is.
Syntax
ptr = realloc (ptr, newsize);