Is it possible to overload operators in C?

五迷三道 提交于 2019-11-29 10:10:49

No, it is not possible. C does not support operator overloading.

If by overload, you mean user defined operator overloads, then the answer is no. However, some of the predefined operators such as *, + etc. are overloaded (if you think about it) for arithmetic types. The * is special since it also has an overload for de-referencing pointers.

C does not support overloading of operators or functions. There's no way you can redefine <, <=, >, >=, ==, or != to compare struct types directly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!