
- Forum
- Programming Talk
- C and C++
- How to get the Size
How to get the Size
This is a discussion on How to get the Size within the C and C++ forums, part of the Programming Talk category; I am starting my try with memory allocation dynamically in C programming language. I have a doubt namely how to ...
-
How to get the Size
I am starting my try with memory allocation dynamically in C programming language. I have a doubt namely how to find at run-time the size of a dynamic memory allocation and this is an array. Kindly suggest some alternatives for achieving the size.
-
07-10-2007, 06:38 AM #2
- Join Date
- May 2007
- Answers
- 12
memory allocation dynamically is done by
malloc() and calloc() functions in C language
provide any example how you want the memory allocation dynamically?
................
-
02-22-2012, 06:54 AM #3
- Join Date
- Feb 2012
- Answers
- 66
Memory is dynamically allocated in c by using malloc(), calloc() and realloc().
void * malloc(size_t size);
The malloc() function takes size_t as its argument and returns a void pointer. Void pointer is used because it can allocate memory for any type.
Just store the size in a variable the same way that we are're storing the pointer in a variable and a struct can be used to put them both together.
-
Sponsored Ads

Reply With Quote





