blob: b1f3bf671174d75a4323b4f0e39545bacdd08c92 [file] [log] [blame]
/* Use of a function pointer embedded in a free'd union. */
#include <stdio.h>
#include <stdlib.h>
typedef int (*pfptr)(const char *, ...);
union test
{
pfptr func;
int value;
};
int main()
{
union test *t;
t = malloc(sizeof(union test) * 10);
t[0].value = 1000;
t[8].func = printf;
free(t);
t[8].func("hello world\n");
return 0;
}