Perform Operator Overloading In C Without Error.
I am always on the move while learning a programming language. This time I am stuck with C. I need to perform operator overloading in C without error. How do I do that?
I am always on the move while learning a programming language. This time I am stuck with C. I need to perform operator overloading in C without error. How do I do that?
Ad hoc polymorphism or operator overloading is a peculiar case where operators implement with different results by their arguments. But, programmers can reassign the semantics of operators by the operand’s type. C itself does not directly support the operator overloading. There are tools that assist the C language to achieve operator overloading.
The host tools such as Lex and Yacc can help you to overload the operators. You can also go for syntactical sugar which is using the similar syntax in C and C++. As everything C++ can do, C can also do, use syntactical sugar seems to be the viable option. But, as I said, C doesn’t support operation overloading by itself.