如何在C中实现函数重载? [英] How to achieve function overloading in C?
本文介绍了如何在C中实现函数重载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以在C中实现函数重载吗?我正在寻找要像
Is there any way to achieve function overloading in C? I am looking at simple functions to be overloaded like
foo (int a)
foo (char b)
foo (float c , int d)
我认为没有直截了当的方法;我正在寻找解决方法(如果存在).
I think there is no straight forward way; I'm looking for workarounds if any exist.
推荐答案
可能性很小:
- printf样式函数(类型作为参数)
- opengl样式函数(在函数名称中键入)
- c ++的c子集(如果可以使用c ++编译器)
这篇关于如何在C中实现函数重载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文