unsigned int and size_t

Asked 2 years ago, Updated 2 years ago, 27 views

The string-related function parameters in the C/C++ STL are: You used size_t instead of int/ unsigned int Why is that? Is there anything good about it?

c++ c size_t

2022-09-21 16:40

1 Answers

The size_t type is the type of sizeof/offset operator result. So of course it's unsingsed integer It is designed to hold the size of any object in the system.

However, for optimization, the compiler will be able to You can also make the size of size_t larger, smaller, or the same size as the unsigned int.


2022-09-21 16:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.