I have the following code:
#include <stdio.h>
#include <stdlib.h>
struct Book {
char title[50];
char author[50];
char subject[100];
int numPages;
int numBooks;
int (*p) (int *, int *);
};
int sum (int *a, int *b) {
return *a + *b;
}
int main() {
struct Book var;
var.numPages = 7;
var.numBooks = 9;
int allPages = (*var.p) (&var.numPages, &var.numBooks);
printf("%d\n", allPages);
return (EXIT_SUCCESS);
}
I trying to use function in struct but my program have no result, no warning although I used -Wall, -Wextra. I'm a newbie. Hope everybody help.