Memory Management in C

  • Unique Paper ID: 142754
  • Volume: 2
  • Issue: 6
  • PageNo: 257-258
  • 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.

Cite This Article

  • ISSN: 2349-6002
  • Volume: 2
  • Issue: 6
  • PageNo: 257-258

Memory Management in C

Related Articles

Impact Factor
8.01 (Year 2024)

Join Our IPN

IJIRT Partner Network

Submit your research paper and those of your network (friends, colleagues, or peers) through your IPN account, and receive 800 INR for each paper that gets published.

Join Now

Recent Conferences

NCSEM 2024

National Conference on Sustainable Engineering and Management - 2024 Last Date: 15th March 2024

Submit inquiry