Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C structs

Name: Anonymous 2013-07-15 8:43

/Prog/, just a minute of your time, please. I'm reading a book and it has a piece of C code like this:

typedef struct {
 void (*print) (struct * shape);
 // data fields
} shape;

I'm trying to compile it and it doesn't work, I'm guessing it's because the book is old. How do you do that type of thing in modern C? I.e. define a struct with a pointer to a function that takes a pointer to a struct you're defining.

Name: Anonymous 2013-07-15 13:18


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List