What is size_t in C?

前端 未结 13 2000
礼貌的吻别
礼貌的吻别 2020-11-22 05:00

I am getting confused with size_t in C. I know that it is returned by the sizeof operator. But what exactly is it? Is it a data type?

Let\'

13条回答
  •  猫巷女王i
    2020-11-22 05:15

    size_t is a type that can hold any array index.

    Depending on the implementation, it can be any of:

    unsigned char

    unsigned short

    unsigned int

    unsigned long

    unsigned long long

    Here's how size_t is defined in stddef.h of my machine:

    typedef unsigned long size_t;
    

提交回复
热议问题