+ 4

C - Why can't you define a function inside a struct?

19th Jan 2020, 9:15 PM
Paolo De Nictolis
Paolo De Nictolis - avatar
6 Answers
+ 5
You can use function pointers. It can work well.
19th Jan 2020, 9:23 PM
Théophile
Théophile - avatar
+ 5
Because the language does not allow it.
20th Jan 2020, 3:25 AM
Sonic
Sonic - avatar
+ 3
Because C is not C++? 😉
19th Jan 2020, 9:20 PM
HonFu
HonFu - avatar
+ 3
Théophile, can you give a minimalistic example of how that works?
19th Jan 2020, 9:32 PM
HonFu
HonFu - avatar
+ 2
Nice, Jay!
20th Jan 2020, 12:15 AM
HonFu
HonFu - avatar
+ 2
HonFu it seems that I hadn't the time to answer... Nice code, Jay Matthews!
20th Jan 2020, 6:08 AM
Théophile
Théophile - avatar