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 *); }
1.4m articles
1.4m replys
5 comments
57.0k users