Code Example.
// written by ¼Bõ»¨
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
typedef struct notebook
{
char content[16];
void (*show_content)(char *content);
} notebook;
void show_type1(char *content)
{
puts("============================");
printf("%s\n", content);
puts("============================");
}
void show_type2(char *content)
{
puts("****************************");
printf("%s\n", content);
puts("****************************");
}
int main()
{
notebook *mynote = 0;
mynote = (notebook*) malloc(sizeof(notebook));
mynote->show_content = show_type1;
puts("write your content:");
gets(mynote->content);
puts("This is your content:");
mynote->show_content(mynote->content);
return 0;
}