![](https://img-blog.csdnimg.cn/2020080612463774.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
C/C++易错
123
Legends_Never_Die
这个作者很懒,什么都没留下…
展开
-
关于结构体
typedef struct L{ int data; struct L *next;}link,*linklist;void initlist(linklist &L){ L=(linklist)malloc(sizeof(link));}int main(){ link *node; initlist(node); node-&...原创 2018-04-11 17:32:30 · 239 阅读 · 0 评论 -
C++中常量指针和普通指针的相互赋值问题
C++ 中禁止把const char* 型指针变量的内容赋给char *型指针变量(C中会警告),但是char *型指针变量的内容可以赋给const char*型指针变量int main(){ int b=1; const int *p=&b; int *p1=p; *p1=2; cout<<b<<endl;}不能把co...原创 2018-05-14 22:47:13 · 2184 阅读 · 0 评论 -
C++引用
引用是C++的一种导出型数据类型引用又称为别名,是为已经定义的变量重新起一个别名,C++不为引用类型变量分配内存空间对于数组只能引用数组元素,不能引用数组名(本身为地址)...原创 2018-06-04 23:30:08 · 124 阅读 · 0 评论 -
关于const
int main(){ typedef char* pstr; char string[]="123"; const char* p1 =string; const pstr p2=string; p1++; p2++; printf("%s,%s",p1,p2); return 0;}编译后显示:D:\Codeblock...原创 2018-08-18 22:46:13 · 125 阅读 · 0 评论 -
运算符优先级问题
#include <iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cctype>#include<string>using namespace std;int main(){ int a=0,b=1,c=2; ...原创 2018-09-15 10:41:31 · 165 阅读 · 0 评论