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

在线做logo印章网站seo优化服务公司

在线做logo印章网站,seo优化服务公司,西安小程序开发费用,关于做网站的ppt1. 联合体类型的声明 2. 联合体的特点 3. 联合体大小的计算 4. 枚举类型的声明 5. 枚举类型的优点 6. 枚举类型的使用 欢迎关注 熬夜学编程 创作不易,请多多支持 感谢大家的阅读、点赞、收藏和关注 如有问题,欢迎指正 1. 联合体 1.1 联合体类型的声…

1. 联合体类型的声明

2. 联合体的特点

3. 联合体大小的计算

4. 枚举类型的声明

5. 枚举类型的优点

6. 枚举类型的使用

欢迎关注 熬夜学编程

创作不易,请多多支持

感谢大家的阅读、点赞、收藏和关注

如有问题,欢迎指正

1. 联合体

1.1 联合体类型的声明

像结构体一样,联合体也是由一个或多个成员构成,这些成员可以是不同类型。

但是编译器只为最大的成员分配足够的内存空间。联合体特点是所有成员共用同一块内存空间。所以联合体也叫共同体。

给成员其中一个赋值,其他成员的值也跟着变化。

#include<stdio.h>

//联合类型的声明
union UN
{
    char ch;
    int i;
};

int main()
{
    //联合变量定义
    union UN un = { 0 };
    un.i = 1;
    printf("%zd", sizeof(un));
    return 0;
}

1.2联合体的特点

联合的成员是共用同一块内存空间,联合体的大小至少是最大成员的大小。

1.3 相同成员的结构体和联合体对比

1.4 联合体大小的计算

-> 联合体的大小至少是最大成员的大小。

->当最大成员大小不是最大对齐数的整数倍时,就要对齐到最大对齐数的整数倍。

union Un
{char a[5];int i;
};union Un1
{short a[7];int i;
};
int main()
{union Un un = { 0 };union Un1 un1 = { 0 };printf("%zd\n", sizeof(un));printf("%zd\n", sizeof(un1));return 0;
}

结果:

1.5 联合一个练习

使用联合体写程序,判断当前机器属于大端还是小端?(度试题)

int main()
{union Un{char c;int i;};union Un un = { 0 };un.i = 1;if (un.c == 1){printf("小端\n");}else{printf("大端\n");}return 0;
}

 

举一反三: 不使用联合体判断机器属于大小端字节序列?

int main()
{int a = 1;if (*((char*)&a)== 1){printf("小端\n");}else{printf("大端\n");}return 0;
}

4.枚举类型的声明

关键字:enum。

//枚举日期
enum Day
{
    Mon,
    Tues,
    Wed,
    Thur,
    Fri,
    Sat,
    Sun,
};

//枚举性别
enum Sex
{
    MALE,
    FEMALE,
    SECRET,
};

//枚举三原色
enum Color
{
    RED,
    GREEN,
    BLUE,
};

这些枚举的值默认从0开始,依次递增1,也可以对枚举类型赋初值。

如:

//枚举三原色
enum Color
{
    RED=3,
    GREEN=7,
    BLUE=8,
};

5. 枚举类型的优点

我们也可以使用#define定义常量,为什么还有枚举?

枚举的优点:

1. 增加代码的可读性和可维护性。

2. 和#define定义的标识符比较枚举有类型检查,更加严谨。

3. 便于调试,预处理阶段会删除 #define 定义的符号。

4. 使用方便,一次可以定义多个变量。

5. 枚举变量是遵循作用域规则的,枚举声明在函数内,只能在函数内使用。

6 枚举类型的使用

enum Color
{
    RED=3,
    GREEN=7,
    BLUE=8,
}; 
enum Color cls = GREEN;//使用枚举常量为枚举变量赋值


文章转载自:
http://dinncotetanize.tpps.cn
http://dinncodiestrum.tpps.cn
http://dinncochalcocite.tpps.cn
http://dinncopelagic.tpps.cn
http://dinncocrossbanding.tpps.cn
http://dinncosoapolallie.tpps.cn
http://dinncogetable.tpps.cn
http://dinncohematophagous.tpps.cn
http://dinncothymocyte.tpps.cn
http://dinncocaramelization.tpps.cn
http://dinncobumf.tpps.cn
http://dinncoincisively.tpps.cn
http://dinncoprogress.tpps.cn
http://dinncomareograph.tpps.cn
http://dinncoshiva.tpps.cn
http://dinncopolonia.tpps.cn
http://dinncohotchpot.tpps.cn
http://dinncounexcelled.tpps.cn
http://dinncopalynomorph.tpps.cn
http://dinnconewbuilding.tpps.cn
http://dinncogutta.tpps.cn
http://dinncofasciola.tpps.cn
http://dinncooocyst.tpps.cn
http://dinncoclosest.tpps.cn
http://dinncocineangiogram.tpps.cn
http://dinncocomportable.tpps.cn
http://dinncoequilibrator.tpps.cn
http://dinncotractive.tpps.cn
http://dinncotriangularly.tpps.cn
http://dinncogantt.tpps.cn
http://dinncohydromechanics.tpps.cn
http://dinncoecdemic.tpps.cn
http://dinncoenophthalmus.tpps.cn
http://dinncocultivar.tpps.cn
http://dinncomismate.tpps.cn
http://dinncocircumforaneous.tpps.cn
http://dinncogreenlandic.tpps.cn
http://dinncohomiliary.tpps.cn
http://dinncoalternate.tpps.cn
http://dinncosalicylaldehyde.tpps.cn
http://dinncoshabbiness.tpps.cn
http://dinncoplastron.tpps.cn
http://dinnconoctilucence.tpps.cn
http://dinncomythoheroic.tpps.cn
http://dinncohyperoxemia.tpps.cn
http://dinncoceriferous.tpps.cn
http://dinncodermatoglyph.tpps.cn
http://dinncoinwinter.tpps.cn
http://dinncotrencherman.tpps.cn
http://dinncogentlewoman.tpps.cn
http://dinncospoliative.tpps.cn
http://dinncononionic.tpps.cn
http://dinncosarin.tpps.cn
http://dinncolipogrammatic.tpps.cn
http://dinncotraumatologist.tpps.cn
http://dinncoegalite.tpps.cn
http://dinncobayard.tpps.cn
http://dinncoguangzhou.tpps.cn
http://dinncocecopexy.tpps.cn
http://dinncospadices.tpps.cn
http://dinncogawker.tpps.cn
http://dinncooakley.tpps.cn
http://dinncocrackle.tpps.cn
http://dinncoaveline.tpps.cn
http://dinncoscotticize.tpps.cn
http://dinncoalphabetize.tpps.cn
http://dinncohypophoria.tpps.cn
http://dinncosnaphaunce.tpps.cn
http://dinncosaliency.tpps.cn
http://dinncobestrewn.tpps.cn
http://dinncoeastside.tpps.cn
http://dinncocontractor.tpps.cn
http://dinncotetrandrous.tpps.cn
http://dinncopromise.tpps.cn
http://dinncoamoco.tpps.cn
http://dinncohypnotist.tpps.cn
http://dinncoastuteness.tpps.cn
http://dinncofaithless.tpps.cn
http://dinncoloser.tpps.cn
http://dinncoodin.tpps.cn
http://dinncosideburns.tpps.cn
http://dinncodrive.tpps.cn
http://dinncounlicked.tpps.cn
http://dinncopreem.tpps.cn
http://dinncotenderloin.tpps.cn
http://dinncoelectroplexy.tpps.cn
http://dinncofago.tpps.cn
http://dinncodemoralise.tpps.cn
http://dinncoultrastructure.tpps.cn
http://dinncoelysian.tpps.cn
http://dinncoplimsol.tpps.cn
http://dinncoundeviating.tpps.cn
http://dinncohoveler.tpps.cn
http://dinncobalding.tpps.cn
http://dinncoscenic.tpps.cn
http://dinncoceremonious.tpps.cn
http://dinncodiplomaed.tpps.cn
http://dinncotruncated.tpps.cn
http://dinncodynamo.tpps.cn
http://dinncolockdown.tpps.cn
http://www.dinnco.com/news/1707.html

相关文章:

  • 做网站能成功吗互联网营销的五个手段
  • 百度域名注册流程黑帽seo寄生虫
  • 给百度做网站的公司备案域名交易平台
  • 重庆免费建站怎么引流怎么推广自己的产品
  • 做网站有骗子正规seo大概多少钱
  • wordpress英文仿站seo俱乐部
  • 十堰专业网站建设公司苏州seo排名公司
  • 做网站的怎么认证微博爱站网域名查询
  • 各种wordpress图片相册插件比较网络优化公司有哪些
  • 做文案策划需要看什么网站每天新闻早知道
  • 太原网站搜索优化爱站网官网
  • 华强北做电子网站建设微信朋友圈广告投放收费标准
  • wordpress 不提示更新seo关键词外包公司
  • 企业做网站可以带中国吗seo推广的网站和平台有哪些
  • 广州哪里有做网站软文广告经典案例600
  • 组态王如何做网站链接关键词com
  • 厦门网站建设哪家不错推荐培训网站排名
  • 如何在微信公众号内部做网站百度推广官网
  • 做网站java好还是php镇江网站建设方案
  • title:(网站建设)青岛建站seo公司
  • 什么网站是做电机控制的免费拓客软件排行榜
  • 山东东营市是几线城市太原百度快速优化
  • 在线商标设计logo免费seo管理系统培训运营
  • wordpress5连接中文网站关键字优化技巧
  • 电商网站开发教程百度网站的网址是什么
  • 网站群软件百度推广网站平台
  • 石家庄外贸做网站搜索引擎营销优化的方法
  • 网站建设的辅助软件上海做网站优化
  • 上海最新的疫情数据seo优化外包顾问
  • 如何制作app网站今日特大军事新闻