A lot of very good answers ... But keeping it simple
According to ISO IEC 14882: 2011 (E)
Β§ 18.2 6 The size_t type is an unsigned integer type defined for implementation that is large enough to contain the size in bytes of any object.
Use it if you know for sure that you are dealing with whole whole signs. For the most part, the array indices correspond to the count.
Secondly, it is useful when the code should be a neutral platform. As on a 16-bit processor versus a 32-bit and a 64-bit processor, an unsigned integer will have a different size and, therefore, it is better to use size_t. Consequently, it is widely used in libraries.
source share