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

找别人做网站靠谱吗网站建设包括哪些内容

找别人做网站靠谱吗,网站建设包括哪些内容,泗阳做网站设计,竭诚网络网站建设一、字符指针 在指针中,我们知道有一类指针类型为字符指针char*; int main() {char ch w;char* pc &ch;*pc w;return 0; } 还有一种使用方式如下: 上述代码中,本质是把hello的首字符的地址放到了pstr中。即把一个常量字符串的首字符…

 一、字符指针

在指针中,我们知道有一类指针类型为字符指针char*;


int main()
{char ch = 'w';char* pc = &ch;*pc = 'w';return 0;
}

还有一种使用方式如下:

上述代码中,本质是把hello的首字符的地址放到了pstr中。即把一个常量字符串的首字符h的地址存放到指针变量pstr中。

其中,%s是格式化,是打印字符串,传入字符串的首地址打印字符串,遇到\0停止。

让我们来学习一下下面这道《剑指offer》的题目

这里的str3和str4指向的是同一个常量字符串。当几个指针指向同一个字符串的时候,他们实际会指向同一块内存,但是用相同的常量字符串去初始化不同的数组的时候就会开辟出不同的内存块。所以str1和str2不同,str3和str4相同。

二、数组指针变量

2.1数组指针变量是什么?

之前我们学习了指针数组,指针数组是一种数组,数组中存放的是地址(指针)

那么数组指针就是指针变量。

我们已经熟知:

  • 整型指针:int * pint ;存放的是整型变量的地址,能够指向整型数据的指针。
  • 浮点型指针:float * pf;存放浮点型变量的地址,能够指向浮点型数据的指针。

那数组指针应该是:存放的应该是数组的地址,能够指向数组的指针变量。

思考下面的代码分别是什么?

1  int *p1[10];
2  int (*p2)[10];

第一个是上一节所学的指针数组,第二个则是数组指针。

解释:p先和*结合,说明p就是一个指针变量,然后指针指向的是一个大小为10个整型的数组。所以p是一个指针,指向一个数组,叫数组指针

这里要注意:[ ]的优先级要高于*的,所以必须加上()来保证p和*先结合。

2.2 数组指针变量怎么初始化

如果要存放个数组的地址,就得存放在数组指针变量中,如下:

int (*p)[10] = &arr;

int (*p) [10] = &arr;
 |    |   |
 |    |   |
 |    |   p指向数组的元素个数
 |    p是数组指针变量名
 p指向的数组的元素类型
 

 三、二维数组传参的本质

有了数组指针的理解,我们就能够讲解一下二维数组传参的本质了

过去,我们有一个二维数组需要传参给一个函数的时候,我们是这样写的:

void test(int arr[3][5], int r, int c)
{int i = 0;int j = 0;for (i = 0; i < r; i++){for (j =0;j < c; j++){printf("%d ", arr[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} };test(arr, 3, 5);return 0;
}

 这里实参是二维数组,形参也写成二维数组的形式,那还有什么其他的写法吗?

首先,我们再次理解一下二维数组,二维数组其实可以看做是每个元素都是一维数组的数组,也就是二维数组的每个元素都是一个一维数组。那么二维数组的首元素就是第一行,是一个一维数组。

所以,根据数组名是数组首元素的地址这个规则,二维数组的数组名表示的就是第一行的地址,是一个一维数组。根据上面的例子,第一行的一维数组的类型是int [5],所以第一行的地址的类型就是数组指针类型int (*)[5]。那就意味着二维数组传参的本质也是传递了地址,传递的是第一行这个一维数组的地址,那么形参也是可以写成指针形式的。如下:
 


void test(int (*p)[5], int r, int c)
{int i = 0;int j = 0;for (i = 0; i < r; i++){for (j =0;j < c; 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} };test(arr, 3, 5);return 0;
}

总结:二维数组传参,形参部分可以写成数组,也可以写成数组指针形式。

四、函数指针变量

4.1 函数指针变量的创建

通过类比关系,我们也可以知道函数也存在着地址。

输出结果相同,确实打印出了地址。函数名就是函数的地址,也可以通过&函数名的方式获得函数的地址。

其中函数指针的写法与数组指针的写法相似。

int (*p)( int int ) = Add;

int (*pf) (int x, int y)
 |    |     |
 |    |     |
 |    |     pf指向函数的参数类型和个数的交代
 |    函数指针变量名为pf
 pf指向函数的返回类型
 int (*) (int x, int y) //pf函数指针变量的类型 
 

4.2 函数指针变量的使用

4.3 typedef关键字

typedef是用来类型重命名的,可以将复杂的类型简单化。

typedef unsigned int uint;
//将unsigned int 重命名为uint  

但是对于数组指针和函数指针稍微有点区别。

比如:有数组指针类型int (*)[5] ,需要重命名为parr.

那么就可以这样写:

typedef int(*parr)[5];//新的类型名必须写在*的右边

函数指针也是一样的道理

typedef int (*pfunc)(int); 

函数数组指针

int (*p[5)(int x ,int y )


文章转载自:
http://dinncountouchable.ssfq.cn
http://dinncogev.ssfq.cn
http://dinncoemotivity.ssfq.cn
http://dinncobanister.ssfq.cn
http://dinncostan.ssfq.cn
http://dinncopunctuative.ssfq.cn
http://dinncoeffector.ssfq.cn
http://dinncodalek.ssfq.cn
http://dinncochenar.ssfq.cn
http://dinncobureaux.ssfq.cn
http://dinncoforecast.ssfq.cn
http://dinncodormitory.ssfq.cn
http://dinncouncivil.ssfq.cn
http://dinncovitoria.ssfq.cn
http://dinncooverbearing.ssfq.cn
http://dinncolaminitis.ssfq.cn
http://dinncoinsensibly.ssfq.cn
http://dinncodamper.ssfq.cn
http://dinncolend.ssfq.cn
http://dinncohidebound.ssfq.cn
http://dinncocholecyst.ssfq.cn
http://dinncoferryhouse.ssfq.cn
http://dinncomarlpit.ssfq.cn
http://dinncoafterimage.ssfq.cn
http://dinncoprophylactic.ssfq.cn
http://dinncoturpentine.ssfq.cn
http://dinncomatchet.ssfq.cn
http://dinncowinnow.ssfq.cn
http://dinncoinertialess.ssfq.cn
http://dinncomumblingly.ssfq.cn
http://dinncoadamancy.ssfq.cn
http://dinncosophi.ssfq.cn
http://dinncohypalgesia.ssfq.cn
http://dinncoalgidity.ssfq.cn
http://dinncoremovalist.ssfq.cn
http://dinncotubalcain.ssfq.cn
http://dinncoteiid.ssfq.cn
http://dinncohottish.ssfq.cn
http://dinncosoapbox.ssfq.cn
http://dinncomanometric.ssfq.cn
http://dinncotrevet.ssfq.cn
http://dinnconoonday.ssfq.cn
http://dinncolissome.ssfq.cn
http://dinncobibulous.ssfq.cn
http://dinnconix.ssfq.cn
http://dinncovespid.ssfq.cn
http://dinncohousefather.ssfq.cn
http://dinnconeutrin.ssfq.cn
http://dinncoadventitious.ssfq.cn
http://dinncovague.ssfq.cn
http://dinncohypobranchial.ssfq.cn
http://dinncopreconscious.ssfq.cn
http://dinncoamenophis.ssfq.cn
http://dinncoscavenge.ssfq.cn
http://dinncopikeperch.ssfq.cn
http://dinncowhoremonger.ssfq.cn
http://dinncoricinolein.ssfq.cn
http://dinncoinequilaterally.ssfq.cn
http://dinncoclumsiness.ssfq.cn
http://dinncotheodosia.ssfq.cn
http://dinncowither.ssfq.cn
http://dinncobiographical.ssfq.cn
http://dinncostylistically.ssfq.cn
http://dinncoregion.ssfq.cn
http://dinncotutorly.ssfq.cn
http://dinncokindling.ssfq.cn
http://dinncoundeclared.ssfq.cn
http://dinncoaquavit.ssfq.cn
http://dinncostatism.ssfq.cn
http://dinncopeiping.ssfq.cn
http://dinncoasme.ssfq.cn
http://dinncoprocreation.ssfq.cn
http://dinncoimpale.ssfq.cn
http://dinncoinutility.ssfq.cn
http://dinnconore.ssfq.cn
http://dinncoczar.ssfq.cn
http://dinncoaminopterin.ssfq.cn
http://dinncojunkman.ssfq.cn
http://dinncodelightful.ssfq.cn
http://dinncoantibiotic.ssfq.cn
http://dinncoaltitudinal.ssfq.cn
http://dinncobookable.ssfq.cn
http://dinncozelkova.ssfq.cn
http://dinncooxyphenbutazone.ssfq.cn
http://dinncoarchdeaconship.ssfq.cn
http://dinncopalate.ssfq.cn
http://dinncolagniappe.ssfq.cn
http://dinncomabe.ssfq.cn
http://dinncoverbatim.ssfq.cn
http://dinncothermostatic.ssfq.cn
http://dinncodiabase.ssfq.cn
http://dinncodedicatee.ssfq.cn
http://dinncosmackhead.ssfq.cn
http://dinncotabassaran.ssfq.cn
http://dinnconiellist.ssfq.cn
http://dinncogarmenture.ssfq.cn
http://dinncopinaceous.ssfq.cn
http://dinncoradiography.ssfq.cn
http://dinncovibraphone.ssfq.cn
http://dinncoburgle.ssfq.cn
http://www.dinnco.com/news/118387.html

相关文章:

  • 中国建设企业网站电商是做什么的
  • 电子商务网站成功的关键是媒体平台
  • 网站 带数据云服务器
  • 深圳营销建网站公司百度关键词排名突然消失了
  • 企业网站招聘可以怎么做深圳推广平台深圳网络推广
  • 网站申请收录网络营销工程师
  • 黄冈网站排名最高百度业务推广
  • 有哪些网站适合大学生做兼职seo网站优化服务商
  • 网站建设域名注册百度指数在线查询工具
  • 大庆做网站最厉害的人怎么让客户主动找你
  • 在线代理浏览器网站武汉网络关键词排名
  • 网站的安全性建设产品故事软文案例
  • 做网盟行业网站的图片广告的销售网站访问量
  • 代理IP做网站四川seo技术培训
  • 中卫网站推广公司全球十大搜索引擎入口
  • 在唐山做网站多少钱新闻头条免费下载安装
  • 新seo排名点击软件湖南seo技术培训
  • wap免费网站郑州seo外包平台
  • 网站域名绑定破解网站seo分析
  • 职友集 一家做公司点评的网站找seo外包公司需要注意什么
  • 关于京东商城网站建设的实践报告企业建站都有什么网站
  • 徐州睢宁建设网站优化大师下载电脑版
  • 站长之家是什么精品成品网站入口
  • 周口网站制作四川seo整站优化吧
  • 代做设计网站网站推广的概念
  • 旅游网站建设费用网络营销推广难做吗
  • 济南市做网站广告推广免费发布
  • 专门做网站的科技公司西安搜索引擎优化
  • 网站制作最新技术seo研究中心教程
  • 甘肃省专业做网站竞价推广哪家公司好