size_t

Posted jasperzhao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了size_t相关的知识,希望对你有一定的参考价值。

size_t is a defined type (through typedef) which is basically an unsigned long int. 

Since the idea of a negative value for a size isn‘t practical sometimes,

it is a type that is used to help find degenerate values during debugging.

 

Example:

size_t X = 100;

printf("X = %u
", (unsigned long) X);

size_t is defined in various header files such as:

<stddef.h>, <stdio.h>, <stdlib.h>, <string.h>, <time.h>, <wchar.h> 

 

以上是关于size_t的主要内容,如果未能解决你的问题,请参考以下文章

size_t和unsigned int区别

编组 SIZE_T* 的正确方法?

使用 `size_t` 作为计数器的类型

“std::size_t”在 C++ 中有意义吗?

size_t是什么数据类型?为什么要用size_t替代intunsigned intunsigned longunsigned long long

C:为啥 size_t 不是 C 关键字?