What is the difference between size_t and int in C++?

Here we will see what are the differences between size_t and int in C++. If we consider the standard, both are integers of size 16 bits.

On a typical 64-bit system, the size_t will be 64-bit, but unsigned int will be 32 bit. So we cannot use them interchangeably.

One standard recommendation is that the size_t be at most as big as an unsigned long. So you may think that we can use unsigned long in the place of size_t, but unsigned long on 64-bit system, if the OS ins Windows, will be of 32-bits, but size_t will be of 64-bits.

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know