小编Kar*_*nke的帖子

C++指针问题

仍然在C++工作,但这出现在我的书中,我不明白它是什么:

MyClass * FunctionTwo (MyClass *testClass) {
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我的问题是第一个间接运算符的重要性是什么

(MyClass *[<- this one] FunctionTwo(MyClass *testClass))?
Run Code Online (Sandbox Code Playgroud)

我尝试在代码块中创建一个类似的函数,有和没有第一个*,我没有看到它运行的方式或输出的任何差异:

int *testFunc(int *in) {
    cout << in << endl;
    cout << *in << endl;
    return 0;
}

int testFuncTwo(int *in) {
    cout << in << endl;
    cout << *in << endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我在书中找不到任何解释它的地方.

谢谢,

卡尔

c++ pointers function

3
推荐指数
1
解决办法
258
查看次数

标签 统计

c++ ×1

function ×1

pointers ×1