How can double pointers be used in dynamic memory allocation in C?

  • To allocate multi-dimensional arrays
  • To create pointer arrays
  • To manage pointer arithmetic
  • To pass a pointer to a pointer
Double pointers are used in dynamic memory allocation when you need to pass a pointer to a pointer (to allocate and manage multi-dimensional arrays) or create arrays of pointers. They provide an extra level of indirection, which is beneficial for managing memory efficiently.
Add your answer
Loading...

Leave a comment

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