FORTRAN 77 Language Reference

Memory and Address by MALLOC() Function

The function MALLOC() allocates an area of memory and returns the address of the start of that area. The argument to the function is an integer specifying the amount of memory to be allocated, in bytes. If successful, it returns a pointer to the first item of the region; otherwise, it returns an integer 0. The region of memory is not initialized in any way.

Example: Memory allocation for pointers, by MALLOC

	POINTER ( P1, X ), ( P2, Y ), ( P3, Z ) 
	P1 = MALLOC ( 10000 ) 


In the above example, MALLOC() allocates 10,000 bytes of memory and associates the address of that block of memory with the pointer P1.