get_size()
should be an user defined function here. Don't need to waste your time finding its header.
Where is the function get_size?
-
21-09-2022 - |
Question
I'm reading the book C++ Primer 5th Edition. On Page 477 a function get_size()
is used to allocate an array of int
, as pasted below.
// call get_size to determine how many ints to allocate
int *pia = new int[get_size()]; // pia points to the first of these ints
I have tried:
#include <new>
#include <memory>
but didn't work. I googled this function as well, but still in vain.Which header should I include before it can be used in my code?
Solution
OTHER TIPS
That's just a random thing the book used as a example of the type of information to pass to new
, e.g., the amount of the memory to allocate. It's not an actual function, at least not in the standard library.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow