It segfaults because you have not assigned the print
pointer. Try this instead:
int main(int argc, char * argv[])
{
Book book = {
.title="Jaws",
.year=2000,
.print=print
};
print(&book); // this works
book.print(&book); // this no longer seg faults
}
CLICK HERE to find out more related problems solutions.