Chapter

Dynamic Memory

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. How does malloc() allocate memory for a dynamic array?

    "Recall that static arrays have many shortcomings (see Section 7.2). In general they should be avoided since stack space is limited and they cannot be returned from functions. Fortunately, C provides

  2. How do you use and validate a dynamically allocated array?

    "Once created, a dynamic array can be used just like a static array. You use the array’s identifier as well as an index to access or modify each element. The same rules and pitfalls apply, so care mus

  3. What other memory allocation functions and pointer cast options does C provide?

    "There are other functions that can be used to allocate memory in C. For example, calloc() is similar to malloc() but initializes the contents to zero (null bytes). realloc() can be used to resize an

Dynamic Memory | ComputerScienceOne | Bifalgorithm | Bifalgorithm