+ 18
Is it possible to include function inside a structure in C language
12 Respuestas
+ 12
Not possible...The idea is to put a pointer to a function inside the struct. The function is then declared outside of the struct. This is different from a class in
C++ where a function is declared inside the class.
+ 5
No... I think so
+ 5
~ swim ~ does the ability for a struct to contain a function pointer make C pseudo object oriented?
+ 4
Not possible
+ 3
Woow
+ 3
Funny I was just thinking today that a structure of function pointers would be a good way to provide a common interface for different implementations.
+ 3
I think you can't. only pointers are allowed to include according to my knowledge
0
You cannot declare a function in a structure as the structure is itself included in a function i.e. int main() or void main() or in any other function you may declare, and you cannot declare a funtion into another function.