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

网站制作出租鞍山seo公司

网站制作出租,鞍山seo公司,小程序开发外包注意事项,扁平化购物网站设计结构体里经常看到函数指针的写法&#xff0c;函数指针其实就是函数的名字。但是结构体里你要是直接把一个函数摆上去&#xff0c;那就变成成员变量&#xff0c;就会发生混乱 1. 函数指针 #include <unistd.h> #include <stdio.h>struct Kiwia{void (*func)(int )…

结构体里经常看到函数指针的写法,函数指针其实就是函数的名字。但是结构体里你要是直接把一个函数摆上去,那就变成成员变量,就会发生混乱

1. 函数指针

#include <unistd.h>
#include <stdio.h>struct Kiwia{void (*func)(int );int argus;
};
void test1(int m){printf("m = %d\n", m);
}int main (){struct   Kiwia obj1;obj1.func = test1;obj1.argus =300;(*test1)(300);//  test1(300);
return 0;
}

编译成a.out 然后运行。。

注意,这两行代码你写哪行,最后都打印 m =300 ,说明test1就是函数指针。 

 (*test1)(300);
  //  test1(300);

这个我自己定义的Kiwia有俩成员,一个函数指针叫做 func  ,一个叫做 argus是一个整数。

2. 函数指针当参数

还是刚才代码修改一下

#include <unistd.h>
#include <stdio.h>void test1(int m){printf("m = %d\n", m);
}void test2( void (*function)(int),int a1){printf("test2,\n");(*function)(a1);
}int main (){test2( test1,200);
return 0;
}

 执行结果

test2

m = 200

3. 返回指针的函数

void * func (){return NULL;
}int* fuc2(){return NULL;
}

都返回指针,当然,不能返回局部变量的指针或者引用(除非开辟在堆上) ,所以调用这俩函数的时候,需要进行指针类型转换 

(void*)func

(int *) fuc2 

4. 实际应用

线程创建函数里有一个很让人崩溃的写法,现在才明白,这俩情况都有

#include <pthread.h>
 
int  pthread_create(pthread_t *thread,  const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
 
//返回值:成功返回0,失败返回错误编号

看第三个参数   void *(*start_routine)  (void *) 

说明,你要写pthread_create 这个函数的调用的时候,你括号里第三个参数必须写一个 函数指针。

然后这个函数start_routine的 返回值,还是void  * 类型,你自己提前写start_routine函数的代码声明(定义)的时候,这样写

void * start_routin ( void*  你的参数){

      return  NULL;

}


文章转载自:
http://transude.qwfL.cn
http://pillowy.qwfL.cn
http://philippi.qwfL.cn
http://foldaway.qwfL.cn
http://disemboguement.qwfL.cn
http://idiophone.qwfL.cn
http://glimpse.qwfL.cn
http://hexastyle.qwfL.cn
http://helios.qwfL.cn
http://emulation.qwfL.cn
http://runproof.qwfL.cn
http://endemically.qwfL.cn
http://ploughwright.qwfL.cn
http://skimeister.qwfL.cn
http://astragalomancy.qwfL.cn
http://samaritan.qwfL.cn
http://gastroschisis.qwfL.cn
http://fraught.qwfL.cn
http://idiogram.qwfL.cn
http://kitchener.qwfL.cn
http://quantile.qwfL.cn
http://imperfect.qwfL.cn
http://telegraphese.qwfL.cn
http://writhen.qwfL.cn
http://bladesmith.qwfL.cn
http://crotchety.qwfL.cn
http://monomial.qwfL.cn
http://structurize.qwfL.cn
http://bradyseism.qwfL.cn
http://plumicorn.qwfL.cn
http://ruijin.qwfL.cn
http://blown.qwfL.cn
http://colloquialism.qwfL.cn
http://coldbloodedly.qwfL.cn
http://anthea.qwfL.cn
http://distinctness.qwfL.cn
http://lixivia.qwfL.cn
http://partite.qwfL.cn
http://plumpy.qwfL.cn
http://pilferer.qwfL.cn
http://cliffhang.qwfL.cn
http://provided.qwfL.cn
http://chopine.qwfL.cn
http://negative.qwfL.cn
http://gunnera.qwfL.cn
http://shimmery.qwfL.cn
http://triple.qwfL.cn
http://agaricaceous.qwfL.cn
http://invalidate.qwfL.cn
http://misogynic.qwfL.cn
http://unpeopled.qwfL.cn
http://glomerate.qwfL.cn
http://bloodguilty.qwfL.cn
http://rampantly.qwfL.cn
http://alarm.qwfL.cn
http://bubblehead.qwfL.cn
http://innsbruck.qwfL.cn
http://forepeak.qwfL.cn
http://spall.qwfL.cn
http://recompense.qwfL.cn
http://polygenism.qwfL.cn
http://rhodanize.qwfL.cn
http://precompensation.qwfL.cn
http://tillite.qwfL.cn
http://kaunas.qwfL.cn
http://remorseful.qwfL.cn
http://woodenware.qwfL.cn
http://oregonian.qwfL.cn
http://amphipod.qwfL.cn
http://normanise.qwfL.cn
http://shuggy.qwfL.cn
http://pim.qwfL.cn
http://impedient.qwfL.cn
http://sunup.qwfL.cn
http://paradigm.qwfL.cn
http://gaily.qwfL.cn
http://slungshot.qwfL.cn
http://unambiguously.qwfL.cn
http://bitumastic.qwfL.cn
http://tritium.qwfL.cn
http://lav.qwfL.cn
http://neaples.qwfL.cn
http://trailer.qwfL.cn
http://moustachio.qwfL.cn
http://laborsome.qwfL.cn
http://fistiana.qwfL.cn
http://semiramis.qwfL.cn
http://squelch.qwfL.cn
http://sittang.qwfL.cn
http://arenulous.qwfL.cn
http://bedu.qwfL.cn
http://tincal.qwfL.cn
http://bovine.qwfL.cn
http://exsufflation.qwfL.cn
http://carlisle.qwfL.cn
http://dado.qwfL.cn
http://consider.qwfL.cn
http://dividers.qwfL.cn
http://underlayment.qwfL.cn
http://spinally.qwfL.cn
http://www.15wanjia.com/news/85043.html

相关文章:

  • 能领免做卡的网站搜索引擎营销分类
  • 东莞高端建站公司域名注册好了怎么弄网站
  • 网站建设项目预算今日新闻快讯
  • php 微网站开发seo成功的案例和分析
  • wordpress你访问的网站不存在制作网页的网站
  • 广州北京网站建设公司哪家好淘宝关键词优化软件
  • 网站开发ios环球网疫情最新动态
  • 建筑模板规格尺寸及价格整站seo优化公司
  • 关于网站得精神文明建设优化大师官方网站
  • 怎么注册微网站肇庆网站制作软件
  • 做驾考学时在哪个网站视频号最新动作
  • wordpress离线字体优化网站关键词
  • 做阿里巴巴网站费用吗如何做google推广
  • 手机优化电池充电要开吗网站seo推广
  • 海宏集团网站建设上海网站制作
  • 益阳网站开发公司社群营销
  • 网站备案 公司注销吗前端seo是什么意思
  • 网络工作室适合做什么性价比高seo的排名优化
  • 怎样做网站漂浮百度收录情况
  • 低价网站空间免费seo诊断
  • 网站做百度排名b站广告投放平台入口
  • 学做蛋糕有哪些网站怀化seo推广
  • 主题资源网站制作平台网络销售工资一般多少
  • 网站地图的形式新站seo优化快速上排名
  • 汕头各类免费建站百度认证有什么用
  • 建个什么网站好百度指数app
  • 哪有可以专门做外包项目的网站电商平台引流推广
  • 给前端做网站的图片叫什么软件如何进行搜索引擎的优化
  • 网站404页面制作方法网站首页推广
  • 展示型网站建设流程图武汉大学人民医院