随笔分类 -  C/C++

摘要:指针函数:一个函数的返回值为指针,则该函数叫做指针函数。 int *fun(int a,int b){ } 函数指针:指向一个函数的指针变量,用来存放函数的入口地址。 int (*fun)(int,int); 阅读全文
posted @ 2020-06-10 18:35 xuecl 阅读(307) 评论(0) 推荐(0)
摘要:指针数组:存放指针的数组,本质上来说,它是一个数组 int *a [3]; 数组指针:指向数组的指针,本质上来说,它是一个指针 int (*a)[3];//指向一个int a[][3]数组的指针 阅读全文
posted @ 2020-06-10 18:05 xuecl 阅读(289) 评论(0) 推荐(0)
摘要:https://www.cnblogs.com/pylearner/p/10903266.html 阅读全文
posted @ 2020-06-05 23:58 xuecl 阅读(352) 评论(0) 推荐(0)
摘要:#include <stdio.h> void main(void) { if (printf("hello world!")) {} } 阅读全文
posted @ 2020-06-05 23:56 xuecl 阅读(230) 评论(0) 推荐(0)
摘要:#include<stdio.h> void fun(char *a){ if(*a == '\0'){ return ; } fun(a+1); printf("%c",*a); } int main(){ char s[] = {'a','b','c','d','e'}; fun(s); ret 阅读全文
posted @ 2020-06-05 23:51 xuecl 阅读(1126) 评论(0) 推荐(0)
摘要:#include<stdio.h> void fun(char *str,int len){ for(int i=0;i<len/2;i++){ char temp = str[i];str[i] = str[len-1-i]; str[len-1-i] = temp; } for(int i=0; 阅读全文
posted @ 2020-06-05 23:50 xuecl 阅读(240) 评论(0) 推荐(0)
摘要:https://www.cnblogs.com/Anker/archive/2013/03/09/2951878.html 阅读全文
posted @ 2020-06-05 00:34 xuecl 阅读(149) 评论(0) 推荐(0)
摘要:http://c.biancheng.net/view/2275.html构造函数 http://c.biancheng.net/view/2276.html析构函数 阅读全文
posted @ 2020-05-13 12:19 xuecl 阅读(159) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/lihao21/article/details/8634876?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase&dept 阅读全文
posted @ 2020-05-13 12:07 xuecl 阅读(190) 评论(0) 推荐(0)
摘要:1. 全局静态变量 在全局变量前加上关键字static,全局变量就定义成一个全局静态变量. 静态存储区,在整个程序运行期间一直存在。 初始化:未经初始化的全局静态变量会被自动初始化为0(自动对象的值是任意的,除非他被显式初始化); 作用域:全局静态变量在声明他的文件之外是不可见的,准确地说是从定义之 阅读全文
posted @ 2020-05-13 10:44 xuecl 阅读(1498) 评论(0) 推荐(0)
摘要:假设: 二叉树的结点数为n, 叶子结点数为n0, 度为1的结点数为n1, 度为2的结点数为n2, 边的数量为b 则有:n = n0 + n1 + n2; b = n - 1;(树的性质:边数量 = 结点数 - 1) 变形:b = n0 + n1 + n2 - 1; b = n1 + 2 * n2;( 阅读全文
posted @ 2020-05-12 13:32 xuecl 阅读(3035) 评论(0) 推荐(2)
摘要:转:https://www.runoob.com/cplusplus/cpp-class-access-modifiers.html 阅读全文
posted @ 2020-03-12 20:11 xuecl 阅读(260) 评论(0) 推荐(0)
摘要:逻辑运算符 && 逻辑与(乘法) || 逻辑或(加法) !逻辑非(取反) 位运算符 & 与 | 或 ~ 非 ^ 异或(相同为0,相异为1) << 左移(左移n位,就是原数乘以2的n次方——十进制) >> 右移(右移n位,就是原数除以2的n次方——十进制) 阅读全文
posted @ 2020-03-12 16:34 xuecl 阅读(910) 评论(0) 推荐(0)
摘要:存储类定义 C++ 程序中 变量/函数 的 范围(可见性)和 生命周期。这些说明符放置在它们所修饰的类型之前。下面列出 C++ 程序中可用的存储类: auto :声明变量并初始化时,根据右值来确定左值的类型 register :声明的变量存储在寄存器上,而不是内存上,不能使用“&”运算符(因为它没有 阅读全文
posted @ 2020-03-12 16:16 xuecl 阅读(215) 评论(0) 推荐(0)
摘要:1 #include <iostream> 2 3 int main(){ 4 5 char c1 = 'a'; 6 char c2 = 'b'; 7 8 const char *p = &c1; 9 // *p = 'b';//错 10 p = &c2;//对 11 // 结论:const cha 阅读全文
posted @ 2020-03-06 17:43 xuecl 阅读(268) 评论(0) 推荐(0)