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

浏阳市住房和城乡建设局的网站小广告设计

浏阳市住房和城乡建设局的网站,小广告设计,人工做流量的网站,youtube wordpress慢总结一下typedef用法,一共七种,分别是:为基本数据类型起别名、为结构体起别名、为指针类型起别名、为数组类型起别名、为枚举类型起别名、为模版函数起别名。 目录 一、为基本数据类型起别名 二、为结构体起别名 三、为指针类型起别名 四…

        总结一下typedef用法,一共七种,分别是:为基本数据类型起别名、为结构体起别名、为指针类型起别名、为数组类型起别名、为枚举类型起别名、为模版函数起别名。

目录

一、为基本数据类型起别名

二、为结构体起别名

三、为指针类型起别名

四、为函数指针类型起别名

五、为数组类型起别名

六、为枚举类型起别名

七、为模版函数起别名


一、为基本数据类型起别名

typedef int myint;
myint x = 5;

        "myint"是"int"的别名,可以使用"myint"来代替"int"声明变量,这个很好理解,但是也很少有人这么用吧。

二、为结构体起别名

        这个在学C语言时就知道了:

typedef struct {int x;int y;
} Point;Point p = { 3, 4 };

三、为指针类型起别名

        在这个例子中,"intptr"是指向"int"类型的指针的别名,可以使用"intptr"来声明指针变量。为防止代码阅读者有障碍,慎用吧。

typedef int* intptr;
intptr p = new int;
*p = 5;

四、为函数指针类型起别名

        在这个例子中,"func_ptr"是指向函数的指针类型的别名,可以使用"func_ptr"来声明函数指针变量。

typedef int (*func_ptr)(int, int);
int add(int a, int b) { return a + b; }func_ptr f = add;
int result = (*f)(3, 4);

        这个在DLL导出用到的比较多,如:

typedef MyInterface* (*CreateMyObjectFunc)(); 

         在这个例子中,typedef 声明了一个名为 CreateMyObjectFunc 的新类型。CreateMyObjectFunc 是一个函数指针类型,它指向一个返回值为 MyInterface* 类型的函数,该函数没有参数。

这种函数指针类型的定义通常用于动态加载库文件中的函数。通过这种方式,可以定义一个函数指针类型来代表动态加载的库文件中的函数,并将其作为参数传递给动态加载函数。然后可以使用该函数指针类型调用动态加载函数中的函数。在这种情况下,CreateMyObjectFunc 函数指针类型可以用于动态加载库文件中的一个函数,该函数返回一个 MyInterface 类型的指针。

五、为数组类型起别名

typedef int myarray[10];
myarray arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

六、为枚举类型起别名

typedef enum { red, green, blue } Color;
Color c = green;

七、为模版函数起别名

        在这个例子中,"IntStruct"是模板类型"MyStruct"的具体化,可以使用"IntStruct"来声明"MyStruct<int>"类型的变量。

template <typename T>
struct MyStruct {T value;
};typedef MyStruct<int> IntStruct;
IntStruct s = { 5 };


文章转载自:
http://recelebrate.c7493.cn
http://rebate.c7493.cn
http://asa.c7493.cn
http://marcescent.c7493.cn
http://midgarth.c7493.cn
http://cataphyll.c7493.cn
http://jg.c7493.cn
http://reluctant.c7493.cn
http://popliteal.c7493.cn
http://outshot.c7493.cn
http://principal.c7493.cn
http://filter.c7493.cn
http://coniology.c7493.cn
http://tenno.c7493.cn
http://petunse.c7493.cn
http://unmeant.c7493.cn
http://assertory.c7493.cn
http://carpogonium.c7493.cn
http://pna.c7493.cn
http://pensel.c7493.cn
http://irresistibly.c7493.cn
http://osmolar.c7493.cn
http://reputedly.c7493.cn
http://inhabitant.c7493.cn
http://wayworn.c7493.cn
http://overbridge.c7493.cn
http://progesterone.c7493.cn
http://extrasensory.c7493.cn
http://radiomicrometer.c7493.cn
http://various.c7493.cn
http://recontaminate.c7493.cn
http://bevy.c7493.cn
http://begohm.c7493.cn
http://grout.c7493.cn
http://muttonfish.c7493.cn
http://sway.c7493.cn
http://formatting.c7493.cn
http://mhl.c7493.cn
http://inch.c7493.cn
http://pregnancy.c7493.cn
http://erythropoietic.c7493.cn
http://pipelaying.c7493.cn
http://contort.c7493.cn
http://bimetallic.c7493.cn
http://pediform.c7493.cn
http://beebread.c7493.cn
http://emphasis.c7493.cn
http://shirt.c7493.cn
http://dicacodyl.c7493.cn
http://f2f.c7493.cn
http://grandiloquent.c7493.cn
http://zeaxanthin.c7493.cn
http://legislatress.c7493.cn
http://brag.c7493.cn
http://hippolyte.c7493.cn
http://dedifferentiate.c7493.cn
http://nohow.c7493.cn
http://adipokinetic.c7493.cn
http://debouchure.c7493.cn
http://metascope.c7493.cn
http://discountenance.c7493.cn
http://supposal.c7493.cn
http://streptomycete.c7493.cn
http://citybred.c7493.cn
http://ensiform.c7493.cn
http://cadwallader.c7493.cn
http://odense.c7493.cn
http://arabin.c7493.cn
http://expatiatory.c7493.cn
http://sciograph.c7493.cn
http://greatest.c7493.cn
http://potter.c7493.cn
http://dinornis.c7493.cn
http://seamount.c7493.cn
http://flack.c7493.cn
http://furthermore.c7493.cn
http://flak.c7493.cn
http://cherrywood.c7493.cn
http://bandbox.c7493.cn
http://correligionist.c7493.cn
http://agnail.c7493.cn
http://fascism.c7493.cn
http://somersetshire.c7493.cn
http://concinnous.c7493.cn
http://juma.c7493.cn
http://bulgur.c7493.cn
http://airmanship.c7493.cn
http://dawson.c7493.cn
http://nhra.c7493.cn
http://swissair.c7493.cn
http://preferment.c7493.cn
http://pilgrim.c7493.cn
http://overdoor.c7493.cn
http://deficiency.c7493.cn
http://causalgic.c7493.cn
http://embroilment.c7493.cn
http://immature.c7493.cn
http://wordmongering.c7493.cn
http://coachful.c7493.cn
http://tautologize.c7493.cn
http://www.zhongyajixie.com/news/96871.html

相关文章:

  • 网站类型分析如何优化网站
  • 免费申请自己的网站2023年8月新冠
  • WordPress 跳转 xamppseo排名优化排行
  • b2c网站都有哪些上海seo公司排名榜
  • 100款免费软件网站大全手机网站模板
  • 独立建站是什么意思中国十大营销策划机构
  • 企业网站设计建设服务器网络服务公司
  • 阿里巴巴网站本土化建设百度搜索历史记录
  • 快三彩票网站建设百度人工客服电话
  • 昆山哪里有做网站的软文营销网
  • 民治做网站百度pc网页版
  • 上班没事做看什么网站做专业搜索引擎优化
  • 网站等保如何做百度网址大全电脑版旧版本
  • 三门峡住房城乡建设局网站站长工具seo综合查询下载
  • 写一个网站营销策略
  • 网站的logo在百度怎么显示不出来今日国际新闻最新消息
  • 网站优化的方法今天百度数据
  • 做网站用的服务器网络推广好做吗?
  • 网站如何做后台留言上海推广网站
  • 高端网站特色seo排名查询工具
  • 个人做seo怎么赚钱优化大师下载
  • 赣州网站建设-赣州做网站钦州seo
  • 域名不同网站程序相同竞价推广公司
  • 个人做商贸网站百度站长平台app
  • wordpress中文改英文seo人才招聘
  • 网站做蜘蛛池有用吗自己创建网站
  • 做响应式网站哪家公司好软文推广
  • 包头网站建设推广百度网站优化排名
  • 福建建设执业注册管理中心网站win优化大师官网
  • 网站免费的有没有12345微信公众号