Q:

field ‘’ declared as a function

struct stack {
    char x[LIMIT][10];
    int top;
    void (*push)(struct stack *, char *);
    char *(*pop)(struct stack *self);
    void (*init)(struct stack *self);
    bool (*is_empty)(struct stack *self);
};

struct stack object;
object.push = push_function; // function defined elsewhere
object.pop = pop_function;   // function defined elsewhere
// ...
0

New to Communities?

Join the community