第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > C++基础:函数指针调用方式

C++基础:函数指针调用方式

时间:2021-09-10 19:16:13

相关推荐

C++基础:函数指针调用方式

下面,小编带您去了解一下C++基础:函数指针调用方式,生活就是不断的发现新事物,get新技能~

// test12.cpp : Defines the entry point for the consoleapplication.

//

#include "stdafx.h"

void func(int i)

{

printf("This is for test %i", i);

}

!-- frame contents -- !-- /frame contents --typedef void (*PFUNC)(int);

strUCt FUNC

{

PFUNC pfunc;

};

void callfunc(void pfunc(int), int i)

{

pfunc(i);

}

int main(int argc, char* argv[])

{

void (*pfunc)(int);

pfunc = &func;

pfunc(1);

callfunc(pfunc, 2);

FUNC sfunc;

= &func;

(3);

return 0;

}

更多内容请看C/C++技术专题专题,或

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。