userdefind函数如何在c ++中工作? [英] how userdefind function work in c++?
本文介绍了userdefind函数如何在c ++中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
功能a()
{
}
解决方案
鉴于它什么都不做,它的效果非常好。当然,除了没有编译。
试试这个:
void a()
{
}由于它什么都不返回,它应该有
void
type - C ++没有函数关键字,只需声明返回类型。
然后只需调用它:
a();
请注意,鉴于它实际上没有做任何事情,你可以将呼叫留下来并且几乎一样影响...
以下不是C ++中的函数:
函数a()
{
}
参见:http://thenewboston.org/watch.php?cat=16&number=9 [ ^ ]
顺便说一句,你应该得到一本C ++书并阅读。
请参阅 http://www.stroustrup.com/bs_faq2.html#simple-计划 [ ^ ]。
this is my code:
function a()
{
}解决方案Given that it does nothing, it works pretty well. Apart from not compiling, of course.
Try this:
void a() { }
Since it returns nothing, it should have a
void
type - C++ does not have a keyword for functions, you just declare the return type.
Then just call it:
a();
Mind you, given that it doesn't actually do anything, you could leave the call out and have pretty much the same affect...
The following is not a function in C++ :
function a() { }
See : http://thenewboston.org/watch.php?cat=16&number=9[^]
BTW, you should get a C++ book and read.
See http://www.stroustrup.com/bs_faq2.html#simple-program[^].
这篇关于userdefind函数如何在c ++中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文