0

I was searching about What exactly size_t is. And I found that size_t is some kind of data type that can represent all size of unsigned int. So Can we replace size_t to unsigned long long??

Or Shouldn't we do that because size_t is just unsigned int under 32bit system? Thank you!

KimJunseo
  • 73
  • 3
  • 2
    Yes, `size_t` is a 64-bit type on a 64-bit system. This can also be a portability issue, because it means `size_t` is typically bigger than `int`, so you can't print `size_t` values with `%d` or `%u`, you have to use something like `%zu`. But no, you shouldn't use literal `unsigned long long` when you want/need a `size_t`, you should keep using `size_t`, for readability and portability. – Steve Summit Nov 08 '22 at 23:35

0 Answers0