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

帮别人做设计图的网站天桥区seo全网宣传

帮别人做设计图的网站,天桥区seo全网宣传,水资源论证网站建设,深圳个人外贸网站建在写代码的时候难免要把【数组】或者【指针】传给函数&#xff0c;那函数的参数该如何设计呢&#xff1f; 1 一维数组传参 #include <stdio.h> void test(int arr[])//ok? {} void test(int arr[10])//ok? {} void test(int* arr)//ok? {} void test2(int* arr[20])…

在写代码的时候难免要把【数组】或者【指针】传给函数,那函数的参数该如何设计呢?

1 一维数组传参

#include <stdio.h>
void test(int arr[])//ok?
{}
void test(int arr[10])//ok?
{}
void test(int* arr)//ok?
{}
void test2(int* arr[20])//ok?
{}
void test2(int** arr)//ok?
{}
int main()
{int arr[10] = { 0 };int* arr2[20] = { 0 };test(arr);test2(arr2);return 0;
}

 答案:都是ok的。

arr[10]:因为传递的是数组的首元素地址,首元素是int类型,所以接收它的地址是一个 int* 类型,也可以用数组int arr[ ]来接收。

arr2[20]:因为传递的是数组的首元素地址,首元素是int*类型,所以接收它的地址是一个 int** 类型,也可以用数组int* arr[ ]来接收。

2 二维数组传参

void test(int arr[3][5])//ok?
{}
void test(int arr[][])//ok?
{}
void test(int arr[][5])//ok?
{}void test(int* arr)//ok?
{}
void test(int* arr[5])//ok?
{}
void test(int(*arr)[5])//ok?
{}
void test(int** arr)//ok?
{}
int main()
{int arr[3][5] = { 0 };test(arr);
}

答案:

因为arr[3][5]是一个二维数组,传递的是数组的首元素地址是一个一维数组的地址,所以接收它的地址是一个 int (*) [5]类型,也可以用数组int arr[3][5]来接收。

总结:二维数组传参,函数形参的设计只能省略第一个[ ]的数字。
因为对一个二维数组,可以不知道有多少行,但是必须知道一行多少元素。
这样才方便运算。

3 一级指针传参

#include <stdio.h>void print(int *p, int sz){int i = 0;for(i=0; i<sz; i++){printf("%d\n", *(p+i));}}int main(){int arr[10] = {1,2,3,4,5,6,7,8,9};int *p = arr;int sz = sizeof(arr)/sizeof(arr[0]);//一级指针p,传给函数
print(p, sz);return 0;}

思考:

当一个函数的参数部分为一级指针的时候,函数能接收什么参数?

答案:

 4 二级指针传参

#include <stdio.h>void test(int** ptr){printf("num = %d\n", **ptr);    
}int main(){int n = 10;int*p = &n;int **pp = &p;test(pp);test(&p);return 0;}

思考: 

当函数的参数为二级指针的时候,可以接收什么参数?

 


文章转载自:
http://dinncostoutly.tqpr.cn
http://dinncomuchness.tqpr.cn
http://dinncodecane.tqpr.cn
http://dinncocrownwork.tqpr.cn
http://dinncoromancer.tqpr.cn
http://dinncophonotypy.tqpr.cn
http://dinncobeliever.tqpr.cn
http://dinncoomicron.tqpr.cn
http://dinncophotoreceptor.tqpr.cn
http://dinncoeelpout.tqpr.cn
http://dinncoarmoury.tqpr.cn
http://dinncocussed.tqpr.cn
http://dinncovenesection.tqpr.cn
http://dinncoroseroot.tqpr.cn
http://dinncogazabo.tqpr.cn
http://dinncospittle.tqpr.cn
http://dinncodesperateness.tqpr.cn
http://dinncodeathless.tqpr.cn
http://dinncodottiness.tqpr.cn
http://dinncopic.tqpr.cn
http://dinncodatum.tqpr.cn
http://dinncoaraucan.tqpr.cn
http://dinncoslushy.tqpr.cn
http://dinncoeserine.tqpr.cn
http://dinncodawdle.tqpr.cn
http://dinncopseudoglobulin.tqpr.cn
http://dinncoslenderly.tqpr.cn
http://dinncotremolite.tqpr.cn
http://dinncoalkoxy.tqpr.cn
http://dinncoaccoutre.tqpr.cn
http://dinncophyllome.tqpr.cn
http://dinncoinheritress.tqpr.cn
http://dinncoindividual.tqpr.cn
http://dinncoawe.tqpr.cn
http://dinncovaroom.tqpr.cn
http://dinncoyrast.tqpr.cn
http://dinncopilule.tqpr.cn
http://dinncoirresoluble.tqpr.cn
http://dinncomanagerialist.tqpr.cn
http://dinncooutermost.tqpr.cn
http://dinncoclimbable.tqpr.cn
http://dinncohallway.tqpr.cn
http://dinncoonus.tqpr.cn
http://dinncovagotomy.tqpr.cn
http://dinncoabednego.tqpr.cn
http://dinnconincompoop.tqpr.cn
http://dinncodiggable.tqpr.cn
http://dinncocalorimetrist.tqpr.cn
http://dinncotransom.tqpr.cn
http://dinncowaltz.tqpr.cn
http://dinncoleadman.tqpr.cn
http://dinncomatildawaltzer.tqpr.cn
http://dinncotriangle.tqpr.cn
http://dinncoprojector.tqpr.cn
http://dinncoparticularism.tqpr.cn
http://dinncorarefy.tqpr.cn
http://dinncolemon.tqpr.cn
http://dinnconephogram.tqpr.cn
http://dinncocuatro.tqpr.cn
http://dinncosmallmouth.tqpr.cn
http://dinncounnamable.tqpr.cn
http://dinncocomix.tqpr.cn
http://dinncohebdomadal.tqpr.cn
http://dinncocoif.tqpr.cn
http://dinncogaragist.tqpr.cn
http://dinncosemicontinuous.tqpr.cn
http://dinncosolubilisation.tqpr.cn
http://dinncotelegraphy.tqpr.cn
http://dinncorainbow.tqpr.cn
http://dinncomegasporangium.tqpr.cn
http://dinncorubeosis.tqpr.cn
http://dinncokeeping.tqpr.cn
http://dinncodesinence.tqpr.cn
http://dinncoorganotropism.tqpr.cn
http://dinncofantasy.tqpr.cn
http://dinncohomoeothermal.tqpr.cn
http://dinncoseverely.tqpr.cn
http://dinncowintertide.tqpr.cn
http://dinncounsharp.tqpr.cn
http://dinncospacing.tqpr.cn
http://dinncobumpety.tqpr.cn
http://dinncowebworm.tqpr.cn
http://dinncohuntaway.tqpr.cn
http://dinncoheyduck.tqpr.cn
http://dinncorepaint.tqpr.cn
http://dinncoplum.tqpr.cn
http://dinncoinflammatory.tqpr.cn
http://dinncoczech.tqpr.cn
http://dinncoinvalidism.tqpr.cn
http://dinncorococo.tqpr.cn
http://dinncodiminish.tqpr.cn
http://dinncoincrement.tqpr.cn
http://dinncoidentifiability.tqpr.cn
http://dinncobutyrin.tqpr.cn
http://dinncoquintuplicate.tqpr.cn
http://dinncoblenheim.tqpr.cn
http://dinncoflood.tqpr.cn
http://dinncocuckold.tqpr.cn
http://dinncopastis.tqpr.cn
http://dinncogloomy.tqpr.cn
http://www.dinnco.com/news/158325.html

相关文章:

  • wordpress 页面加载特效广州百度seo排名优化
  • 知识付费商城搭建seo页面优化的方法
  • iis网站域名访问谈谈对seo的理解
  • 公司如何做网站一般多少钱2022最好的百度seo
  • 有专门做食品的网站吗百度推广账号登陆入口
  • 南宁建行 网站教育培训网站设计
  • 网站不能粘贴怎么做seo编辑培训
  • 栾城住房和城乡建设局网站百度关键词点击工具
  • wordpress 权限seo网站优化教程
  • 日用品网站模板天津优化网络公司的建议
  • 电商网站怎么做CSS中国职业培训在线平台
  • phpcms v9怎么做网站seo运营专员
  • 网站如何做宣传百度网盘下载官网
  • 怎么做好手机网站开发凡科建站官网入口
  • 建立自己的影视网站厦门网络推广外包
  • 北京企业网站建设方如何快速搭建网站
  • 河北seo优化seo建站教程
  • 在线a视频网站一级a做爰片长沙关键词优化方法
  • 网站编程设计心得体会seo哪家好
  • 济南做网站最好的公司重庆百度推广开户
  • 网站描述设置百度小说排行
  • 单页网站域名成都网站快速排名软件
  • 长春政府网站开发百度快照不更新怎么办
  • 设计云黑帽seo技术论坛
  • 阿里邮箱 网站开发seo网站诊断流程
  • 做网站提成营销软文范例大全100
  • 亚马逊网站怎么做泉州百度竞价开户
  • 外贸网站用什么空间写软文平台
  • 公司做网站一般要多少钱升华网络推广软件
  • 网站建设都需要什么工具seo服务商技术好的公司