+ 2
size_t
Can you explain to me what is "size_t" type? thank you
5 odpowiedzi
+ 10
According to
http://en.cppreference.com/w/cpp/types/size_t
size_t is an unsigned integer value which is returned by the sizeof operator, which means we can safely assume that size_t can store the maximum size of any object.
According to
https://stackoverflow.com/questions/216259/is-there-a-max-array-length-limit-in-c
The maximum size of an object is not specified by the C++ standard, and instead by the hardware.
+ 7
We don't usually use size_t for variables, but you can use the type to store unsigned integer values which can be used for indexing purposes, e.g. array size,
const std::size_t N = 10;
int* array = new int[N];
+ 6
size_t is used in C rather than C++
And it is often a typedef for unsigned long
0
ok thank you very much , can you give me an eg. of use of it?