How to add function in C struct.

#include <stdio.h>


typedef struct _test
{
	void (*pFunction)();
}STest;

void display()
{
	printf("hello function\n");
}


void main(void)
{
	STest test;
	test.pFunction = display;

	test.pFunction();
}

Done.

posted @ 2017-09-11 13:59  Viewsky  阅读(110)  评论(0)    收藏  举报