C中关键字、预定义标识符的区别

您所在的位置:网站首页 c语言有效标识符 C中关键字、预定义标识符的区别

C中关键字、预定义标识符的区别

2023-08-31 18:11| 来源: 网络整理| 查看: 265

标识符

标识符 = 关键字 + 预定义标识符 + 用户标识符

关键字

关键字也称标准C语言的保留字

标准 C语言的保留字 charintshortlongfloatdoubleifelseswitchcasedefaultwhilebreakreturncontinueforvoidsignedunsignedgotostaticconstsizeofvolatileregistertypedefexternunionautoenumstructdo C99新增关键字 _Bool_Complex_Imaginaryinlinerestrict C11新增关键字 _Alignas_Alignof_Atomic_Generic_Noreturn_Static_assert_Thread_local 预定义标识符

预定义标识符是C语言中系统预先定义的标识符,如系统类库名、系统常量名、系统函数名。预定义标识符具有见字明义的特点,如函数“格式输出”(英语全称加缩写:printf)、“格式输入”(英语全称加缩写:scanf)、sin、isalnum等等。预定义标识符可以作为用户标识符使用,只是这样会失去系统规定的原意,使用不当还会使程序出错,以下为例子:

#include void printf(int* a,int* b){ int t=*a; *a=*b; *b=t; } int main(int argc, char** argv) { int a=1,b=2; printf(&a,&b); std::cout


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3