Memory Management in C
Author(s):
Puneet Saini, Ria Arora
Keywords:
C , Language , Memory Management , malloc , Calloc
Abstract
Manual memory management for dynamic memory allocation in the C programming language is what is referred to as dynamic memory allocation. There are two ways of allocating memory allocated in C, ie, by declaring the variables and by explicitly requesting space. We have discussed variable declaration in other lectures, but here we will describe requesting dynamic memory allocation and memory management. Space is allocated for a pointer by C whenever a pointer is declared. For example: char *p; Four consecutive bytes in memory are allocated which are associated with the variable p. Pointer to char is declared to be the type of pointer p. However, initialization of memory location does not happen, so it may contain garbage.Initialising the pointer at the time it is declared is usually a good idea. Its function is to reduce the chances of a random value in p to be used as a memory address. A pointer must be pointing to a valid area of memory before we can actually use it. The function malloc is used to request a pointer to a block of memory and calloc is used to request an array of zero-value initialized blocks.
Article Details
Unique Paper ID: 142754

Publication Volume & Issue: Volume 2, Issue 6

Page(s): 257 - 258
Article Preview & Download


Share This Article

Conference Alert

NCSST-2021

AICTE Sponsored National Conference on Smart Systems and Technologies

Last Date: 25th November 2021

SWEC- Management

LATEST INNOVATION’S AND FUTURE TRENDS IN MANAGEMENT

Last Date: 7th November 2021

Go To Issue



Call For Paper

Volume 8 Issue 4

Last Date 25 September 2021

About Us

IJIRT.org enables door in research by providing high quality research articles in open access market.

Send us any query related to your research on editor@ijirt.org

Social Media

Google Verified Reviews

Contact Details

Telephone:6351679790
Email: editor@ijirt.org
Website: ijirt.org

Policies