What is dynamic memory example?

Example-: int *ptr; ptr=(int *)malloc(8); This allocates 8 contiguous bytes of memory space and the address of first byte is stored in the pointer variable ptr . This space can hold 4 integers. Unlike memory allocated for variables and arrays, dynamically allocated memory has no name associated with it.

Sizin İçin Seçtik  What can we use instead of switch-case in C?

Leave a Reply

Your email address will not be published. Required fields are marked *