![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++基础语言笔记
文章平均质量分 78
J.Flash
这个作者很懒,什么都没留下…
展开
-
C语言字符串及指向字符数组的指针
字符数组长度通常编译器在“肉眼所能看见的”字符数组末尾还会加一个“\0”作为结束符所以真正的字符长度是“肉眼所见长度”+1char str[5]="Hello";如上代码是会编译错误的指针和字符串#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){ char *s="Hello World"; char *s2="Hello Worl原创 2020-06-25 10:09:09 · 4377 阅读 · 1 评论 -
指针的运算
指针的存储大小#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){ char a[]={0,1,2,3,4,5,6,7,8,9}; char *p=a; printf("p=%p\n",p); printf("p+1=%p\n",p+1); int b[]={0,1,2,3,4,5,6,7,8,9}; int *q=b; printf原创 2020-06-20 23:27:10 · 197 阅读 · 0 评论 -
C语言数组与指针的关系(数组与指针作为函数参数)
**C语言数组作为函数参数**函数参数表中的数组即指针先来看一段代码#include<iostream>#include<cstdio>#include<cstring>using namespace std;void f(int b[]){ printf("%p\n",&b[0]); b[0]=90; b[9]=9;}int main(){ int a[10]={1,0,3,10,7,8,9,89,6,100}; printf原创 2020-06-20 10:11:40 · 1014 阅读 · 0 评论