linux内核中驱动开发常见的相似多态

时间:2014-07-06 15:44:49   收藏:0   阅读:223
#include<stdio.h>
#include<stdlib.h>
struct test
{
	char name[20];
	void (*func)(char *);
};
void tttfunc(char *name)
{
	printf("current is %d\n",__LINE__);
	printf("%s\n",name);
}
int main()
{
	struct test ttt=
	{
		.name = "zhang",
		.func = tttfunc,
	};
	ttt.func(ttt.name);
	return 0;
}
bubuko.com,布布扣

linux内核中驱动开发常见的相似多态,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!