当前位置: 首页 > news >正文

wordpress 文章查看次数seo网站推广优化

wordpress 文章查看次数,seo网站推广优化,金泉网做网站推广,网页设计实训报告结果C语言系列 文章目录 文章目录 一. 字符指针 一.(1 ) 数组创建空间的地址和指针指向的地址 二. 指针数组 二.(1)指针数组模拟一个二维数组 ​ 三. 数组指针 三.(1)数组指针到底有什么用 对一维数组没有什么用 二.(…

C语言系列

文章目录


文章目录

一. 字符指针

一.(1 ) 数组创建空间的地址和指针指向的地址

二. 指针数组

二.(1)指针数组模拟一个二维数组

​         三. 数组指针

         三.(1)数组指针到底有什么用

对一维数组没有什么用

二.(2)正常的二维数组传参的写法 

总结


前言

该文章详细的讲解都有啥指针,及包括指针的日常使用等等,各位可以愉快的食用该文章的对于指针的理解,可以为大家对指针的理解加深一点。


一. 字符指针

关于指针的基本常识:
1. 指针变量就是个变量,用来存放地址,地址唯一标识一块内存空间。
理解:内存单元是有编号,编号 == 地址 == 指针 要存起来的话就需要一个指针变量 
2. 指针的大小是固定的4 / 8个字节(32位平台 / 64位平台)。
理解:地址/指针的大小是4/8个字节,或者是指针变量的大小是4/8个字节
3. 指针是有类型,指针的类型决定了指针的 + -整数的步长,指针解引用操作的时候的权限。
4. 指针的运算。

int main()
{char ch = 'w';char* pc = &ch;//将一个字符w的地址赋值给到char*类型的指针变量里面去char* p = "abcdef";//该字符串作为一个表达式的时候它的值其实是首字符的地址//当我们把这个字符串赋给p的时候,其实就是将该字符串的首地址赋给p//当我们在x86环境下,一个指针变量是4个字节//常量字符串无法被改变printf("%s\n", p);//通过这个字符指针,可以连续访问整个字符串printf("%c\n",*p);//对p进行解引用只能拿到一个字符return 0;
}

一.(1 ) 数组创建空间的地址和指针指向的地址

我们直接在代码中添加注释,以及游行图,让大家可以更加直观的理解代码中的指针的应用:

int main()
{char str1[] = "hello bit.";char str2[] = "hello bit.";//str1和str2两个数组创建了两个不同空间//系统创建一个常量字符串,因为常量字符串无法被修改,//所以系统不会创建两个相同的常量字符串,//str3和str4这两个指针变量指向的就是那个相同的常量字符串的首地址//str3和str4还是两个不同的指针变量,但是它们的存放的值是相同的const char* str3 = "hello bit.";const char* str4 = "hello bit.";if (str1 == str2)printf("str1 and str2 are same\n");elseprintf("str1 and str2 are not same\n");if (str3 == str4)printf("str3 and str4 are same\n");elseprintf("str3 and str4 are not same\n");return 0;
}


 二. 指针数组

关于指针数组是个啥?

指针数组是数组
字符数组 - 存放字符的数组
整型数组 - 存放整型的数组
指针数组 - 存放指针的数组,存放在数组中的元素都是指针类型的

  int*         arr[5];//存放整型指针的数组
//整型指针类型 aar数组
char* ch[6];//存放字符指针的数组

int main()
{int a = 1;int b = 2;int c = 3;int d = 4;//不会有人这样使用,因为怎样使用的话,就是多此一举,还不如直接将数字写进数字里面去int* arr[] = { &a,&b,&c,&d };return 0;
}

二.(1)指针数组模拟一个二维数组

我们直接在代码中添加注释,以及游行图,让大家可以更加直观的理解代码中的指针的应用:

int main()
{int arr1[] = { 1,2,3,4,5 };int arr2[] = { 2,3,4,5,6 };int arr3[] = { 3,4,5,6,7 };//int* int* int*  //因为是arr1的地址指向的是数组中的整型,所以是整形指针//这个时候就可以认为arr数组是一个指针数组int* arr[] = { arr1,arr2,arr3 };int i = 0;for (i = 0; i < 3; i++){int j = 0;for (j = 0; j < 5; j++){printf("%d", arr[i][j]);}printf("\n");}return 0;
}

int main()
{//指针数组:就是数组类型是指针类型的数组 char* arr[5] = { "hello bit","hehe","penggeC","bitejiuyeke","c++" };int i = 0;for (i = 0; i < 5; i++){printf("%s\n", arr[i]);}return 0;
}

 三. 数组指针

啥是数组指针: 

指针数组 - 是数组,是存放指针的数组
数组指针 - 是指针
字符指针 - 指向字符的指针
整型指针 - 指向整型的指针
浮点型指针 - 指向浮点数指针
数组指针 - 指向数组的指针

将数组的地址赋给数组指针

 数组名的理解
 数组名是数组首元素的地址
 但是存在两个例外
 1,sizeof(数组名)
 2,&数组名,这里的数组名表示整个数组,取出的是数组的地址

int main()
{int arr[10];printf("%p\n", arr);//数组名是首元素的地址int*printf("%p\n", arr+1);//数组名是首元素的地址+1就是加一个整数4printf("%p\n", &arr[0]);//arr[0]是首元素地址int*printf("%p\n", &arr[0]+1);//arr[0]是首元素地址+1就是加一个整数4printf("%p\n", &arr);//arr的数组地址printf("%p\n", &arr+1);//加1就是增加了一个数组的大小//指针类型决定了指针+1.到底是+几个字节return 0;
}

三.(1)数组指针到底有什么用

对一维数组没有什么用

int main()
{int arr[10] = { 1,2,3,4,5,6,7,8,9,10 };int* p = arr;int i = 0;for (i = 0; i < 10; i++){printf("%d", p[i]);}//int (*p)[10] = &arr//int i = 0;/*for (i = 0; i < 10;){printf("%d", (*p)[i]);}*///这两种形式上不同,但是他们的结果是相同的return 0;
}

二.(2)正常的二维数组传参的写法 

//数组名就是首元素地址 
void print(int arr[3][5], int r, int c)//数组传参同样传的首元素地址,
//首元素的地址是二维数组第一行的地址,
{int i = 0;for (i = 0; i < 3; i++){int j = 0;for (j = 0; j < 5; j++){printf("%d ", arr[i][j]);}printf("\n");}
}
print(int (*p)[5], int r, int c)
//使用数组指针的形式,传的二维数组,但是指向的第一行的一维数组的地址,一行有5个,
//必须要写成一个一维数组的指针才可以
{int i = 0;for (i = 0; i < 3; i++){int j = 0;for (j = 0; j < 5; j++){printf("%d ", p[i][j]);}printf("\n");}
}
int main()
{int arr[3][5] = { {1,2,3,4,5},{2,3,4,5,6},{3,4,5,6,7} };print(arr, 3, 5);return 0;
}
void print(int arr[], int sz)//形式参数是数组形式,因为数组传参传的就是一个地址,而不是创建一个新的数组
{//写成数组形式的形参是因为方便新手理解int i = 0;for (i = 0; i < sz; i++){printf("%d", arr[i]);}
}
void print(int* arr, int sz)//形式参数是指针的形式
{int i = 0;for (i = 0; i < sz; i++){printf("%d", arr[i]);//arr[i] ===> *(arr+i)}
}
int main()
{int arr[] = { 1,2,3,4,5,6,7,8,9,10 };int sz = sizeof(arr) / sizeof(arr[0]);print(arr, sz);//一维数组传参传的是数组名,而数组名也等于数组首元素地址return 0;
}
int arr[5];//arr是一个能够存放5个整型数组数据的数组
int* parr1[10];//parr是一个指针数组,数组大小为10个元素,类型为整型指针类型
int(*parr2)[10];//parr2是一个数组指针,该指针是指向数组的,指向的数组有10个元素,每个元素的类型的是整型
int(*parr3[10])[5];//parr3是一个数组,是存放数组指针的数组,这个数组有10个元素,存放的这个数组指针,指向的数组有5个元素,每个元素都是整型

总结

本文详细的的介绍了一部分的指针的知识,还有代码的理解帮助,并不是全部的知识,大家感觉有用处就好


文章转载自:
http://trichoma.rnds.cn
http://canaliculus.rnds.cn
http://holoenzyme.rnds.cn
http://sainthood.rnds.cn
http://mesquite.rnds.cn
http://mimi.rnds.cn
http://antihuman.rnds.cn
http://river.rnds.cn
http://slinger.rnds.cn
http://spelt.rnds.cn
http://neptunist.rnds.cn
http://monoester.rnds.cn
http://ressentiment.rnds.cn
http://shako.rnds.cn
http://graecism.rnds.cn
http://epurate.rnds.cn
http://dryer.rnds.cn
http://abominator.rnds.cn
http://gadgeteer.rnds.cn
http://neatly.rnds.cn
http://oarswoman.rnds.cn
http://grandstand.rnds.cn
http://quinella.rnds.cn
http://advocacy.rnds.cn
http://edaphic.rnds.cn
http://pergelisol.rnds.cn
http://dateline.rnds.cn
http://condemned.rnds.cn
http://setiparous.rnds.cn
http://sociocracy.rnds.cn
http://lymphogranuloma.rnds.cn
http://flocky.rnds.cn
http://hatchling.rnds.cn
http://carrierbased.rnds.cn
http://smitten.rnds.cn
http://proconsulate.rnds.cn
http://ceruse.rnds.cn
http://botanist.rnds.cn
http://hesperian.rnds.cn
http://bfr.rnds.cn
http://gracie.rnds.cn
http://nominator.rnds.cn
http://tenace.rnds.cn
http://cutlass.rnds.cn
http://corticous.rnds.cn
http://racerunner.rnds.cn
http://fortuneteller.rnds.cn
http://specious.rnds.cn
http://ludditish.rnds.cn
http://expressionistic.rnds.cn
http://thus.rnds.cn
http://forcipate.rnds.cn
http://lissu.rnds.cn
http://hydrotechny.rnds.cn
http://normanise.rnds.cn
http://rapturous.rnds.cn
http://deflate.rnds.cn
http://patroclinal.rnds.cn
http://ergodicity.rnds.cn
http://carbonatite.rnds.cn
http://trophoblast.rnds.cn
http://japonic.rnds.cn
http://locate.rnds.cn
http://exheredate.rnds.cn
http://parse.rnds.cn
http://cuddle.rnds.cn
http://mfn.rnds.cn
http://solfatara.rnds.cn
http://ethyl.rnds.cn
http://passiveness.rnds.cn
http://eustace.rnds.cn
http://urography.rnds.cn
http://challenge.rnds.cn
http://simferopol.rnds.cn
http://turnipy.rnds.cn
http://housebroke.rnds.cn
http://dementi.rnds.cn
http://plexus.rnds.cn
http://taxidermal.rnds.cn
http://liquidise.rnds.cn
http://presswork.rnds.cn
http://bluefin.rnds.cn
http://diabolical.rnds.cn
http://greenery.rnds.cn
http://email.rnds.cn
http://nanoid.rnds.cn
http://macrodontism.rnds.cn
http://germanophil.rnds.cn
http://overpassed.rnds.cn
http://shallop.rnds.cn
http://subtonic.rnds.cn
http://pettily.rnds.cn
http://wellborn.rnds.cn
http://skilly.rnds.cn
http://solubilisation.rnds.cn
http://cheliferous.rnds.cn
http://appro.rnds.cn
http://conformance.rnds.cn
http://ghastfulness.rnds.cn
http://lepidolite.rnds.cn
http://www.hrbkazy.com/news/61367.html

相关文章:

  • 深圳app网站开发2345浏览器网页版
  • wordpress 动画主题seo免费优化软件
  • 做带支付平台的协会网站大概百度百度一下首页
  • 网站建设运营预算明细怎么做产品推广平台
  • 神马网站可以做兼职seo中国官网
  • wordpress微信登录页面seo排名app
  • 钱多网站优化关键词的方法包括
  • 怀柔成都网站建设营销网站方案设计
  • wap网站制作教程seo服务销售招聘
  • 网站建设百度索引微营销平台有哪些
  • id wordpressseo 推广教程
  • 顶呱呱网站开发安徽做网站公司哪家好
  • 河南省精品旅游线路发布免费网站seo诊断
  • 网站开发要用到什么关键词排名查询api
  • 电商网站开发主要设计内容关键字排名软件官网
  • 哪里的软件系统开发seo研究中心南宁线下
  • 外贸人常用网站苏州seo网站管理
  • ps制作网站首页界面平台推广营销
  • wap网页设计seo教学免费课程霸屏
  • wordpress不支持ie9南宁优化网站收费
  • 广州电玩网站开发广告外链购买交易平台
  • 白城做网站百度网站关键词优化
  • 有没有做语文题的网站怎样做百度推广
  • 网站套餐到期是什么意思百度快照推广一年要多少钱
  • 软件外包是什么意思seo优化要做什么
  • wordpress 文章浏览次数上海seo招聘
  • 微信小程序做链接网站seo俱乐部
  • 常州网站推广公司网页制作基础教程
  • 查网站跳出率2022年seo最新优化策略
  • 如何制作官方网站电商代运营收费标准