随笔分类 -  c/c++

1 2 3 4 5 ··· 30 下一页
摘要:001、 c语言中显示无符号整型数据在计算机存储中二进制位的具体数值 [root@PC1 test2]# cat test.c #include <stdio.h> int bits_count(unsigned x) // 定义函数, 输出二进制位上为1的位数 { int bits; bits = 阅读全文
posted @ 2025-01-03 11:41 小鲨鱼2018 阅读(2) 评论(0) 推荐(0) 编辑
摘要:c语言中输出各种数据类型的长度: [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试程序 #include <stdio.h> int main(void) { printf("size of char: %u\n", (unsi 阅读全文
posted @ 2024-12-23 13:04 小鲨鱼2018 阅读(15) 评论(0) 推荐(0) 编辑
摘要:001、 C语言中的1U表示的是无符号整数1,即unsigned int型的 1. 阅读全文
posted @ 2024-12-21 09:51 小鲨鱼2018 阅读(25) 评论(0) 推荐(0) 编辑
摘要:001、 位(bit)是计算机内部数据存储的最小单位,即0和1; 而字节(byte)是数据处理的基本单位。 1个字节由8个二进制位(bit)组成,可以存储一个字符或表示0到255之间的数字, 2的8次方。 阅读全文
posted @ 2024-12-15 15:04 小鲨鱼2018 阅读(30) 评论(0) 推荐(0) 编辑
摘要:001、 [b20223040323@admin2 test]$ ls test.c [b20223040323@admin2 test]$ cat test.c #include <stdio.h> int main(void) { int i,j,k; ## 三个变量 负数、正数和0 i = - 阅读全文
posted @ 2024-12-15 13:22 小鲨鱼2018 阅读(13) 评论(0) 推荐(0) 编辑
摘要:001、signed既可以表示整数也可以表示负数, 若不指定默认为signed; unsigned表示只可以表示0和正数。 signed 表示有符号的; unsigned表示无符号的; C语言中各种数据类型可以存储的值的范围可以通过一下方式进行输出: [root@localhost test]# l 阅读全文
posted @ 2024-12-15 00:27 小鲨鱼2018 阅读(45) 评论(0) 推荐(0) 编辑
摘要:boost 是一个跨平台的 c++ 库集合,它提供了许多功能和工具,用于在 linux 上开发高性能的应用程序。 阅读全文
posted @ 2024-12-04 00:09 小鲨鱼2018 阅读(8) 评论(0) 推荐(0) 编辑
摘要:001、 [root@PC1 test1]# ls test1.c test2.c [root@PC1 test1]# cat test1.c #include <stdio.h> int main(void) { int i; int x = 10000; for(i = 0; i < 4; i+ 阅读全文
posted @ 2024-11-23 13:18 小鲨鱼2018 阅读(10) 评论(0) 推荐(0) 编辑
摘要:0、 库文件,动态库和静态库的区别 。 阅读全文
posted @ 2024-11-21 22:48 小鲨鱼2018 阅读(3) 评论(0) 推荐(0) 编辑
摘要:001、作用域:快作用域,文件作用域; 指的是变量的作用范围; 作用域控制的是变量的作用范围 如下程序: [root@localhost test]# ls test.c [root@localhost test]# cat test.c ## 测试c程序 #include <stdio.h> in 阅读全文
posted @ 2024-11-21 14:49 小鲨鱼2018 阅读(11) 评论(0) 推荐(0) 编辑
摘要:接收多维数组的函数,可以省略相当于开头下标的n维数组的个数,但是,(n - 1)维下的的元素个数必须是常量。 实质上是多维数组在传递过程中,最高维上表示元素个数是可变的,最高维之后的元素类型是不可变得,比如 int x[][3][2], 元素个数是可变得,而int [3][2]型是固定的。 定义函数 阅读全文
posted @ 2024-11-21 13:03 小鲨鱼2018 阅读(26) 评论(0) 推荐(0) 编辑
摘要:001、 [root@PC1 test1]# ls test.c [root@PC1 test1]# cat test.c ## 测试c程序 #include <stdio.h> void print_array(const int x[4][3]); // 函数原型声明 int main(void 阅读全文
posted @ 2024-11-19 22:30 小鲨鱼2018 阅读(43) 评论(0) 推荐(0) 编辑
摘要:001、一维数组的传递 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试c程序 #include <stdio.h> void print_array(int a[], int b); // 函数原型声明, 末尾需要冒号 int 阅读全文
posted @ 2024-11-18 14:59 小鲨鱼2018 阅读(6) 评论(0) 推荐(0) 编辑
摘要:c语言中const修饰符 001、不使用const修饰符 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试c程序 #include <stdio.h> void print_array(int v[], int n); int 阅读全文
posted @ 2024-11-13 00:49 小鲨鱼2018 阅读(4) 评论(0) 推荐(0) 编辑
摘要:最简单的例子: 001、 不适用extern关键字声明变量 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试c程序 #include <stdio.h> int main(void) { printf("x = %d\n", x 阅读全文
posted @ 2024-11-12 09:35 小鲨鱼2018 阅读(7) 评论(0) 推荐(0) 编辑
摘要:001、 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试c程序 #include <stdio.h> int max_ay(int v[], int n); // 函数原型声明 int main(void) { int v[5 阅读全文
posted @ 2024-11-12 09:35 小鲨鱼2018 阅读(6) 评论(0) 推荐(0) 编辑
摘要:001、 作用域:变量的作用范围; 包括: 01、块作用域:只在程序块中起作用的变量; 02、文件作用域:在函数外声明的变量标识符, 其作用范围从其开始声明的部分开始,一直到程序结束的部分都有效。 阅读全文
posted @ 2024-11-10 09:59 小鲨鱼2018 阅读(7) 评论(0) 推荐(0) 编辑
摘要:存储期可以分为两类:自动存储期和静态存储期。 自动存储期:变量的作用周期在程序块内; 在程序块中使用一般的变量声明模式即可。 静态存储期:变量的作用周期在整个程序期间; 有两种声明方式,1、在程序块外声明; 2、在程序块内使用static关键字 001、自动存储期测试 [root@PC1 test] 阅读全文
posted @ 2024-11-09 17:58 小鲨鱼2018 阅读(11) 评论(0) 推荐(0) 编辑
摘要:001、没有返回值的函数 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试c程序 #include <stdio.h> void put_star(int a) // 定义不含返回值的函数 { while(a-- > 0) pu 阅读全文
posted @ 2024-11-09 17:47 小鲨鱼2018 阅读(23) 评论(0) 推荐(0) 编辑
摘要:001、方法1 while循环 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试c程序 #include <stdio.h> int get_length(int a) { int length = 0; while(a > 0 阅读全文
posted @ 2024-11-08 23:07 小鲨鱼2018 阅读(14) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 30 下一页
点击右上角即可分享
微信分享提示