#include <iostream>
using namespace std;
int myFunc (unsigned short int x );
int main ()
{
unsigned short int x, y;
x=7;
y = myFunc(x);
std::cout << "x:" << x << "y: " << y << "\n";
return 0;
}
int myFunc (unsigned short int x )
{
return (4 * x );
}
现在这 ^ 代码有效,但是当我改变时
y = myFunc(x);
进入
y = myFunc(int);
它不再起作用,这是为什么?
最佳答案
y =myFunc(int);
这不是一个有效的表达式。 int
是一种类型,您不能将类型作为参数传递给函数。
关于C++ : Confused on something about functions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6328439/