摘要: 由于c语言中数据类型实际所占存储位数和精度和具体平台相关,c语言的规范并没有强制和详细的规定, 因此c语言程序在移植过程中可能会出现不同平台数据类型不兼容 的状况。 为了解决这个问题,c语言在可移植类型stdint.h和inttype.h中规定了精确宽度整数类型,以确保c语言的类型在各系统内功能相同 阅读全文
posted @ 2021-07-26 23:30 小鲨鱼2018 阅读(297) 评论(0) 推荐(0) 编辑
摘要: c语言中使用sizeof()输出各种数据类型的大小。 #include <stdio.h> int main(void) { printf("short: %zd.\n", sizeof(short)); printf("int: %zd.\n", sizeof(int)); printf("lon 阅读全文
posted @ 2021-07-26 23:05 小鲨鱼2018 阅读(3824) 评论(0) 推荐(0) 编辑
摘要: c语言中浮点数的声明与输出。 [root@centos79 test]# cat test2.c #include <stdio.h> int main(void) { float f = 1000.0; double d = 1000.0; long double ld = 1000.0; pri 阅读全文
posted @ 2021-07-26 22:52 小鲨鱼2018 阅读(459) 评论(0) 推荐(0) 编辑
摘要: char类型用于存储字符(比如字母或者标点),但是从技术层面讲,char类型是整数,因为char类型存储的是整数而不是字符。 计算机使用字符编码来处理字符,即 用特定的整数来表示特定的字符。 例如在ASCII编码中, 大写字母A存储的是65. char类型通常被定义为8位的存储单元。 通常1个字节被 阅读全文
posted @ 2021-07-26 22:31 小鲨鱼2018 阅读(9024) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { signed short ss= 100; unsigned short us= 100; signed int si= 100; unsigned int ui= 100; signed long sl= 100; un 阅读全文
posted @ 2021-07-26 21:29 小鲨鱼2018 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int num = 100; printf("decimal: %d.\n\n", num); printf("octal: %o.\n", num); printf("octal: %#o.\n\n", num); pr 阅读全文
posted @ 2021-07-26 21:17 小鲨鱼2018 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos79 test]# ls [root@centos79 test]# mkdir test1 [root@centos79 test]# touch test1/a.txt [root@centos79 test]# ll total 0 drwxr-xr-x. 阅读全文
posted @ 2021-07-26 10:49 小鲨鱼2018 阅读(2722) 评论(0) 推荐(0) 编辑
摘要: 1、测试数据 [root@centos79 test]# cat a.txt e r w i s g n c w d h x 2、awk [root@centos79 test]# cat a.txt e r w i s g n c w d h x [root@centos79 test]# awk 阅读全文
posted @ 2021-07-26 00:26 小鲨鱼2018 阅读(1289) 评论(0) 推荐(0) 编辑