Is it possible to use function inside struct on C ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 16

Is it possible to use function inside struct on C ?

I know that C is not OOP, but I want to use struct like a class.

20th Dec 2018, 1:28 PM
Pedro H.J
Pedro H.J - avatar
9 Answers
+ 8
Here is a code I did on OOP in C a while back : https://code.sololearn.com/ctaBYdlTM5rP/?ref=app Here is the latest version of the code : https://github.com/Klevh/Object-Oriented-in-C
20th Dec 2018, 7:59 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 7
No
25th Dec 2018, 10:56 AM
Grandhi priyanka
Grandhi priyanka - avatar
+ 3
No
31st Dec 2018, 3:56 AM
Satyam Verma
Satyam Verma - avatar
+ 2
No
26th Dec 2018, 7:58 AM
Venkata Ajay
Venkata Ajay - avatar
+ 1
No
25th Dec 2018, 2:31 AM
Abhishek Mahato
Abhishek Mahato - avatar
+ 1
Use function pointers inside structure to make class-style calls https://code.sololearn.com/c6Ilj3uHHLn5/?ref=app
30th Dec 2018, 12:36 AM
JanSeliv
JanSeliv - avatar
+ 1
Not directly
8th Jan 2019, 11:04 AM
Jkilop
0
It is not possible to overcome this drawback class is introduced in ObjectOriented or ObjectBased programming languages
14th Feb 2019, 6:04 AM
sree harsha
sree harsha - avatar
- 5
Yes
27th Dec 2018, 3:45 AM
Surendra Kumar
Surendra Kumar - avatar