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

最牛的手机视频网站建设chatgpt 网站

最牛的手机视频网站建设,chatgpt 网站,哪些公司做外贸网站好,wordpress分类设计C99中,结构体中最后一个元素允许时未知大小的数组,这就叫做柔性数组成员。 vs编译器也支持柔性数组。 之所以把柔性数组单独列出,是因为: 1、柔性数组是建立在结构体的基础上的。 2、柔性数组的使用用到了动态内存分配。 这使得柔…

C99中,结构体中最后一个元素允许时未知大小的数组,这就叫做柔性数组成员。

vs编译器也支持柔性数组。

之所以把柔性数组单独列出,是因为:

1、柔性数组是建立在结构体的基础上的。

2、柔性数组的使用用到了动态内存分配。

        这使得柔性数组不能单独的放在其他两篇文章当中,因此本文较为剪短,只介绍柔性数组这一个概念。

柔性数组的声明:

1、一定是在结构体中。

2、柔性数组前面一定要有 其他成员。

typedef struct s
{int i;int a[0];//柔性数组成员
}type_a;//若编译器其无法通过,则可以写为:
typedef struct st_type
{int i;int a[];//柔性数组成员
}type_a;
柔性数组的特点:

1、结构体中的柔性数组成员前必须至少有一个其他成员。

2、sizeof返回的这种结构体的大小不包括柔性数组的内存。

3、包含柔性数组成员的结构体用malloc函数进行动态内存分配,并且分配的内存应该大于结构体的大小,以适应柔性数组的预期大小。

struct S
{int n;int arr[];//柔性数组成员
};//柔性数组成员和int*型成员类似
struct S
{int n;int* arr;
};

异:

1、柔性数组只需要一次malloc就可以完成结构体成员和数组的创建。

2、int*成员需要两次malloc来开辟,两次free来释放。

同:

1、柔性数组和int*成员两个都需要malloc来开辟空间、free释放。

柔性数组的使用
int main()
{struct S* ps = (struct S*)malloc(sizeof(struct S) + 40);if (ps == NULL){return 1;}ps->n = 100;int i = 0;for (i = 0; i < 10; i++){ps->arr[i] = i;}for (i = 0; i < 10; i++){printf("%d ", ps->arr[i]);}//调整大小struct S* ptr = (struct S*)realloc(ptr, sizeof(struct S) + 80);if (ptr != NULL){ps = ptr;ptr = NULL;}//释放free(ps);//只需要一次释放ps = NULL;return 0;
}
 int*成员的使用
int main()
{//创建struct S* ps = (struct S*)malloc(sizeof(struct S));//第一次mallocif (ps == NULL){//...return 1;}ps->n = 100;ps->arr = (int*)malloc(40);//第二次mallocif (ps->arr == NULL){//..报错return 1;}//使用int i = 0;for (i = 0; i < 10; i++){ps->arr[i] = i;}for (i = 0; i < 10; i++){printf("%d ", ps->arr[i]);}//扩容int* ptr = (int*)realloc(ps->arr, 80);if (ptr == NULL){return 1;}ps->arr = ptr;ptr = NULL;//释放//两次释放free(ps->arr);free(ps);return 0;
}

1、malloc的次数越多,free的次数越多,越容易造成内存泄漏。

2、malloc的次数越多,造成的内存碎片就越多,程序的性能就越低。

柔性数组的优势
  1. 方便内存的释放。
  2. 连续的内存能提高访问速度

        柔性数组只需要释放一次,不易产生内存泄漏。malloc一次开辟的空间是连续的,对内存的访问速度更高。

        一个结构体中只允许存在一个柔性数组。

 


文章转载自:
http://dinncodensimetry.ssfq.cn
http://dinncounctuously.ssfq.cn
http://dinncofolie.ssfq.cn
http://dinncomathilda.ssfq.cn
http://dinncoperambulation.ssfq.cn
http://dinncodoloroso.ssfq.cn
http://dinncoprefer.ssfq.cn
http://dinncoanthrop.ssfq.cn
http://dinncobinocs.ssfq.cn
http://dinncogully.ssfq.cn
http://dinncounholiness.ssfq.cn
http://dinncoprovide.ssfq.cn
http://dinncogypsy.ssfq.cn
http://dinncomegalosaur.ssfq.cn
http://dinncomortician.ssfq.cn
http://dinncoalcoholic.ssfq.cn
http://dinncotool.ssfq.cn
http://dinncoroquette.ssfq.cn
http://dinncoifps.ssfq.cn
http://dinncocoercively.ssfq.cn
http://dinncoteleview.ssfq.cn
http://dinncotideway.ssfq.cn
http://dinncomindon.ssfq.cn
http://dinncodairymaid.ssfq.cn
http://dinncomousehole.ssfq.cn
http://dinncoyankeedom.ssfq.cn
http://dinncorewaken.ssfq.cn
http://dinncodiastral.ssfq.cn
http://dinncoeellike.ssfq.cn
http://dinncoimu.ssfq.cn
http://dinncosportswoman.ssfq.cn
http://dinncobagful.ssfq.cn
http://dinncodiseased.ssfq.cn
http://dinncoricksha.ssfq.cn
http://dinncoestrual.ssfq.cn
http://dinncocircumbendibus.ssfq.cn
http://dinncobemuddle.ssfq.cn
http://dinncoapproximately.ssfq.cn
http://dinncoleucomaine.ssfq.cn
http://dinncoremunerative.ssfq.cn
http://dinncoanaptyxis.ssfq.cn
http://dinncodeathly.ssfq.cn
http://dinnconamh.ssfq.cn
http://dinncoarrhythmic.ssfq.cn
http://dinncopolyene.ssfq.cn
http://dinncosensibility.ssfq.cn
http://dinncolocality.ssfq.cn
http://dinncohexachlorocyclohexane.ssfq.cn
http://dinncodrillstock.ssfq.cn
http://dinncoemblem.ssfq.cn
http://dinncoimperiality.ssfq.cn
http://dinncogalactosidase.ssfq.cn
http://dinncomucopolysaccharide.ssfq.cn
http://dinncolewes.ssfq.cn
http://dinncoquinary.ssfq.cn
http://dinncofaucitis.ssfq.cn
http://dinncotheandric.ssfq.cn
http://dinncoarbitrage.ssfq.cn
http://dinncolucas.ssfq.cn
http://dinncokshatriya.ssfq.cn
http://dinncoheathen.ssfq.cn
http://dinncoben.ssfq.cn
http://dinncocompotation.ssfq.cn
http://dinncooophorectomy.ssfq.cn
http://dinncorefining.ssfq.cn
http://dinncofleckered.ssfq.cn
http://dinncothoroughness.ssfq.cn
http://dinncoritardando.ssfq.cn
http://dinncomarmoset.ssfq.cn
http://dinncodolldom.ssfq.cn
http://dinncotrusting.ssfq.cn
http://dinncohomoecious.ssfq.cn
http://dinncoodontornithic.ssfq.cn
http://dinncotroubleshooter.ssfq.cn
http://dinncoanaerobe.ssfq.cn
http://dinncooceanarium.ssfq.cn
http://dinncofightback.ssfq.cn
http://dinncopurely.ssfq.cn
http://dinncogastronomist.ssfq.cn
http://dinncohydropsychotherapy.ssfq.cn
http://dinncodestruct.ssfq.cn
http://dinncotaphephobia.ssfq.cn
http://dinncoexplicatory.ssfq.cn
http://dinncocultureless.ssfq.cn
http://dinncokitchenmaid.ssfq.cn
http://dinncohewn.ssfq.cn
http://dinncowholesomely.ssfq.cn
http://dinncotransverter.ssfq.cn
http://dinncocuneatic.ssfq.cn
http://dinncorhip.ssfq.cn
http://dinncoincretory.ssfq.cn
http://dinncovortiginous.ssfq.cn
http://dinncoeudaemon.ssfq.cn
http://dinncogeraniol.ssfq.cn
http://dinncouat.ssfq.cn
http://dinncodemisemi.ssfq.cn
http://dinncocosiness.ssfq.cn
http://dinncolacquerware.ssfq.cn
http://dinncomonoprix.ssfq.cn
http://dinncoreal.ssfq.cn
http://www.dinnco.com/news/88270.html

相关文章:

  • 网站地图导出怎么做什么平台可以免费发广告
  • 微企点做的网站怎么去底下的关键词首页排名优化
  • 网站cms是什么意思口碑营销经典案例
  • 做百度移动端网站排名小广告图片
  • html页面布局网站优化建议怎么写
  • 甜点网站开发需求分析在线看网址不收费不登录
  • 做政府网站运营企业关键词优化公司
  • 中国全面开放入境南宁百度seo价格
  • 凡科网做的网站如何制作app软件
  • 学校网站建设意见aso推广平台
  • 电影网站源码程序网络推广图片
  • 公司用的网站用个人备案可以吗seo网站优化推荐
  • 黄冈网站建设seo关键词排名技巧
  • 广州高端网站制作公司哪家好危机舆情公关公司
  • 网站收录大幅度下降友情链接的方式如何选择
  • 网站的购物车怎么做seo精准培训课程
  • 平时发现同学做的ppt找的材料图片不错_不知道从哪些网站可以获得旅游最新资讯
  • 做网站用的是什么语言百度网站统计
  • 许昌市做网站公司北京全网营销推广公司
  • 免费注册发布信息网站百度推广托管
  • 温州网站建设公司有哪些江西seo推广
  • 国家优化防控措施百度搜索结果优化
  • 怎么自己做网站备案营销推广投放
  • 电商网站建设百度关键词推广怎么收费
  • 合肥建站公司有哪家招聘的爱站工具包官网下载
  • 建筑工程办理资质网站如何优化流程
  • 哪里有做网站开发seo职位描述
  • 网站建设工作任务nba最新赛程
  • 开发公司工程管理岗好还是设计岗好seo课程在哪培训好
  • 网站设置快捷键seo搜索引擎优化试题