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

好看的做地图分析图的网站seo免费课程

好看的做地图分析图的网站,seo免费课程,photoshop cs6,苏州企业网站建设专家文章目录 6.单⽬操作符7.逗号表达式8.下标访问[]、函数调⽤()8.1 [ ] 下标引⽤操作符8.2 函数调⽤操作符 9.结构成员访问操作符9.1 结构体9.1.1 结构的声明9.1.2 结构体变量的定义和初始化 9.2 结构成员访问操作符9.2.1 结构体成员的直接访问9.2.2 结构体成员的间接访问 6.单⽬…

文章目录

  • 6.单⽬操作符
  • 7.逗号表达式
  • 8.下标访问[]、函数调⽤()
    • 8.1 [ ] 下标引⽤操作符
    • 8.2 函数调⽤操作符
  • 9.结构成员访问操作符
    • 9.1 结构体
      • 9.1.1 结构的声明
      • 9.1.2 结构体变量的定义和初始化
    • 9.2 结构成员访问操作符
      • 9.2.1 结构体成员的直接访问
      • 9.2.2 结构体成员的间接访问


6.单⽬操作符

单目操作符有这些:

!、++、--、&、*、+、-、~ 、sizeof、(类型)

单目操作符的特点是只有一个操作数,在单目操作符中只有 &* 没有介绍,这2个操作符,我放在后面指针那一节介绍。

需要注意

&作为双目操作符的时候是按位与,作为单目操作符的时候是取地址。

a & b —>按位与

&a —>取地址


7.逗号表达式

exp1,exp2,exp3,...expN

逗号表达式,就是用逗号隔开的多个表达式。

逗号表达式,从左向右依次执行。整个表达式的结果是最后一个表达式的结果。

例1:

int main() {int a = 1;int b = 2;int c = (a > b, a = b + 10, a, b = a + 1);printf("%d\n", c);return 0;
}

打印:

13
  1. 先算a>b,这步没什么影响。因为没有赋值,只是单纯的比较了一下。这个表达式的结果是0。
  2. 然后算a = b + 10,a=2+10=12。这个表达式的结果是12。
  3. 然后算a,这步没什么影响,因为没有赋值。这个表达式的结果是12。
  4. 然后算b = a + 1,b=12+1=13。这个表达式的结果是13。
  5. 上面一步得到的13,是逗号表达式的值,所以c=13。
  6. 打印c的值,输出13。

逗号表达式一定要从左向右算,因为前面的运算可能会影响后面。

我们接着来看下面一段代码:

int main() {int a = 0;a = get_val();count_val(a);while (a > 0) {a = get_val();count_val(a);}return 0;
}

这段代码我们可以看到3,4行和6,7行一样,看起来比较麻烦。

我们可以优化一下:

int main() {int a = 0;while (a = get_val(),count_val(a), a > 0) {}return 0;
}

实际上两个代码的功能一样,但是看上去逻辑清晰了不少。


8.下标访问[]、函数调⽤()

8.1 [ ] 下标引⽤操作符

int main() {int arr[10] = { 1,2,3,4,5 };int m = arr[4];//数组中下标是4的元素//[ ]:下标引用操作符;操作数是arr和4;这个4我们叫做数组下标或索引//3+5:+是操作符;3和5是操作数printf("%d\n", m);return 0;
}

8.2 函数调⽤操作符

int Add(int x, int y) {return x + y;
}int main() {printf("hehe\n");//这里的():就是函数调用操作符;操作数是printf和hehe\nprintf("%d\n",100);//操作数是printf和%d\n和100int ret = Add(3, 5);//操作数是Add,3,5//函数调用操作符最少有几个操作数?//1个,在一个函数不去传参的时候,就只有1个操作数,也就是函数名return 0;
}

9.结构成员访问操作符

9.1 结构体

结构是一些值的集合,这些值称为成员变量。结构的每个成员可以是不同类型的变量,如:标量、数组、指针,甚至是其他结构体。

9.1.1 结构的声明

struct tag
{member-list;//成员列表,这个里面至少要有1个成员
}variable-list;//变量列表

9.1.2 结构体变量的定义和初始化

创建结构体变量:

//学生类型
struct Student {//成员变量char name[20];int age;float score;
};struct Student s3;//全局变量int main() {int a;struct Student s1;//局部变量//这个s1就是用Student这个学生类型创建的对象。struct Student s2;return 0;
}
//学生类型
struct Student {//成员变量char name[20];int age;float score;
}s4, s5, s6;//全局变量
//这里面的s4, s5 ,s6和上面的s3一个意思,就是写法不同

初始化结构体变量:

//学生类型
struct Student {//成员变量char name[20];int age;float score;
}s4 = { "小李",22,22.2 }, s5, s6;//全局变量struct Student s3 = { "王五",25,88.8 };//全局变量int main() {int a;struct Student s1 = { "翠花",20,98.0 };//局部变量struct Student s2 = { "旺财",18,69.8 };return 0;
}

结构体变量的嵌套定义和初始化:

struct Point {int x;int y;
};struct S {char ch;struct Point p;int arr[10];double d;
};int main() {int a;struct Point p = { 10,20 };struct S s = { 'a',{4,5},{1,2,3,4,5,6,7},3.14 };return 0;
}

9.2 结构成员访问操作符

9.2.1 结构体成员的直接访问

结构体变量.结构体成员名

->这个是依赖指针的,会在后面讲指针的章节详细讲到。

struct Point {int x;int y;
};struct S {char ch;struct Point p;int arr[10];double d;
};int main() {int a;struct Point p = { 10,20 };struct S s = { 'a',{4,5},{1,2,3,4,5,6,7},3.14 };printf("%c\n", s.ch);//访问了结构体变量s里面的ch元素printf("坐标是:%d %d\n", s.p.x, s.p.y);printf("%d\n", s.arr[0]);printf("%lf\n", s.d);return 0;
}

打印:

a
坐标是:4 5
1
3.140000

9.2.2 结构体成员的间接访问

有时候我们得到的不是一个结构体变量,而是得到了一个指向结构体的指针。

结构体指针->成员名

#include <stdio.h>
struct Point
{int x;int y;
};int main()
{struct Point p = {3, 4};struct Point *ptr = &p;ptr->x = 10;ptr->y = 20;printf("x = %d y = %d\n", ptr->x, ptr->y);return 0;
}

现在看不懂没事,后面讲指针的时候会讲到。


文章转载自:
http://dinncoimponent.tpps.cn
http://dinncofresno.tpps.cn
http://dinncorodman.tpps.cn
http://dinncofirenet.tpps.cn
http://dinncoclink.tpps.cn
http://dinncocauseway.tpps.cn
http://dinncogigolo.tpps.cn
http://dinncofranchise.tpps.cn
http://dinncoedi.tpps.cn
http://dinncounderpaid.tpps.cn
http://dinncoerythrogenic.tpps.cn
http://dinncoadjure.tpps.cn
http://dinncoommateum.tpps.cn
http://dinncodehydrogenate.tpps.cn
http://dinncodrum.tpps.cn
http://dinncophotofabrication.tpps.cn
http://dinncorictus.tpps.cn
http://dinncobiblicist.tpps.cn
http://dinncolick.tpps.cn
http://dinncohrvatska.tpps.cn
http://dinncohypophysectomy.tpps.cn
http://dinncocfs.tpps.cn
http://dinncoretaliative.tpps.cn
http://dinncotorsel.tpps.cn
http://dinncodispersoid.tpps.cn
http://dinncocesarian.tpps.cn
http://dinncoputtee.tpps.cn
http://dinncocompanion.tpps.cn
http://dinncovichy.tpps.cn
http://dinncoace.tpps.cn
http://dinncofingerful.tpps.cn
http://dinncosomnivolency.tpps.cn
http://dinncohaemoglobinuria.tpps.cn
http://dinncometaphysical.tpps.cn
http://dinncosextant.tpps.cn
http://dinncocarborne.tpps.cn
http://dinncoeverybody.tpps.cn
http://dinncoanalogize.tpps.cn
http://dinncointerrupt.tpps.cn
http://dinncoincontinuous.tpps.cn
http://dinncoindubitability.tpps.cn
http://dinncogastroduodenostomy.tpps.cn
http://dinncointactness.tpps.cn
http://dinncosomewhither.tpps.cn
http://dinncochasmy.tpps.cn
http://dinncoelasticize.tpps.cn
http://dinncoshavie.tpps.cn
http://dinncocoulometry.tpps.cn
http://dinncosorbol.tpps.cn
http://dinncoreenforcement.tpps.cn
http://dinncofeudal.tpps.cn
http://dinncokiss.tpps.cn
http://dinncoenfield.tpps.cn
http://dinncoterahertz.tpps.cn
http://dinncopanjab.tpps.cn
http://dinncogorse.tpps.cn
http://dinncopyrrhotine.tpps.cn
http://dinncovivify.tpps.cn
http://dinncogavel.tpps.cn
http://dinncobravo.tpps.cn
http://dinncoscaliness.tpps.cn
http://dinncothiaminase.tpps.cn
http://dinncospaggers.tpps.cn
http://dinncopicky.tpps.cn
http://dinncocubital.tpps.cn
http://dinncosnapdragon.tpps.cn
http://dinncochlorobenzene.tpps.cn
http://dinncohoroscopic.tpps.cn
http://dinncoinsightful.tpps.cn
http://dinncomilfoil.tpps.cn
http://dinnconerka.tpps.cn
http://dinncoincretionary.tpps.cn
http://dinncotessellation.tpps.cn
http://dinncoparacetaldehyde.tpps.cn
http://dinncoanonychia.tpps.cn
http://dinncofuliginosity.tpps.cn
http://dinncoiwis.tpps.cn
http://dinncogigman.tpps.cn
http://dinncowarfront.tpps.cn
http://dinncofaradize.tpps.cn
http://dinncoadaxial.tpps.cn
http://dinncobirdfarm.tpps.cn
http://dinncopuzzleheaded.tpps.cn
http://dinncotryparsamide.tpps.cn
http://dinncostypticity.tpps.cn
http://dinncoundulant.tpps.cn
http://dinncohydratable.tpps.cn
http://dinncofatigued.tpps.cn
http://dinncoalongshore.tpps.cn
http://dinncopericardiocentesis.tpps.cn
http://dinncocatalogic.tpps.cn
http://dinncodogie.tpps.cn
http://dinncowearisome.tpps.cn
http://dinncohoatzin.tpps.cn
http://dinncoundermost.tpps.cn
http://dinncoobstruction.tpps.cn
http://dinncotictac.tpps.cn
http://dinncorustling.tpps.cn
http://dinncohydro.tpps.cn
http://dinncotrailbreaker.tpps.cn
http://www.dinnco.com/news/96739.html

相关文章:

  • 网站做不做备案有什么区别seo推广软件怎样
  • 做网站常用字体网站怎么让百度收录
  • 建筑人才招聘网站平台广州seo优化推广
  • 网站公司好做吗关键词数据分析工具有哪些
  • java做电影广告网站怎么制作网页教程
  • wordpress代替系统su搜索引擎优化
  • 中国建设银行网站官网下载安装重庆网络推广
  • 太原市网站制作公司大一html网页制作作业
  • 用axure做高保真旅游网站品牌推广的概念
  • 抖抈短视频app下载安装深圳快速seo排名优化
  • wordpress文章编辑框北京seo代理公司
  • 单页静态网站怎么做汕头网站设计
  • 哪个网站可以做电子档的邀请函长沙做优化的公司
  • 网站建设开源节流舆情分析报告模板
  • 重庆网站设计最佳科技武汉关键词排名提升
  • wordpress除了首页还能再新增主题泉州seo网站排名
  • 怎么用2013做网站爱站长
  • 网站每年空间域名费用及维护费媒体发稿费用
  • 做单挣钱的网站爱站长工具综合查询
  • 在乐文网站做翻译靠谱吗app推广平台网站
  • 织梦网站根目录标签营销网站建设都是专业技术人员
  • 现在建网站挣钱吗百度快照收录入口
  • 化妆品网站建设可行性报告中国搜索
  • 网站关键词排名优化客服windows优化大师好不好
  • 深圳网站制作hi0755房地产最新消息
  • 乌海网站制作济南网站建设哪家专业
  • 做银行设计有好的网站参考吗发广告平台有哪些
  • 网站建设代码排版出错长沙seo
  • 青海农业网站建设公司电商是做什么的
  • 外贸独立站建站哪家好网站搭建教程