size_t和int在C中有什么区别?

在几个C示例中,我看到一个类型size_t的使用,我将使用一个简单的int。有什么区别,为什么size_t应该更好?
the friendly Wikipedia

The stdlib.h and stddef.h header files define a datatype called size_t which is used to represent the size of an object. Library functions that take sizes expect them to be of type size_t, and the sizeof operator evaluates to size_t.

The actual type of size_t is platform-dependent; a common mistake is to assume size_t is the same as unsigned int, which can lead to programming errors, particularly as 64-bit architectures become more prevalent.

此外,请检查Why size_t matters

http://stackoverflow.com/questions/502856/whats-the-difference-between-size-t-and-int-in-c

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:size_t和int在C中有什么区别?