C 编程语言中定义的“int”和“char”类型在哪里?

2024-04-06

我正在研究C语言是如何工作的。我可以找到类似类型的定义int8_t, intptr_t等在<stdlib.h>:

// Represents true-or-false values
typedef _Bool bool;
enum { false, true };

// Explicitly-sized versions of integer types
typedef __signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;

// Pointers and addresses are 32 bits long.
// We use pointer types to represent virtual addresses,
// uintptr_t to represent the numerical values of virtual addresses,
// and physaddr_t to represent physical addresses.
typedef int32_t intptr_t;
typedef uint32_t uintptr_t;
typedef uint32_t physaddr_t;

但是,我找不到像这样的类型的定义char。因此我的问题是,在哪里int and char定义?


头文件在哪个char定义?

无处可去-char is a builtin类型,而不是用户自定义一。它是核心语言的一部分。这同样适用于int.

难道这些都没有定义吗?builtin types?

有。该标准确实定义了这些内置类型。


请注意,两者char and int也都是keywords,这意味着你不能将它们用作身份标识,因为它们在语言中具有保留且已分配的用途。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

C 编程语言中定义的“int”和“char”类型在哪里? 的相关文章

随机推荐