Can we define functions in structs in C programming language?
No, as functions are not data. But you can define function pointers inside a struct.
struct foo { int a; void (*workwithit)(struct foo *); }
2.1m questions
2.1m answers
60 comments
57.0k users