在我的main函数中有两个函数。
我试着用指针来解决这个问题,但是作为一个初学者,使用它是非常复杂的。
int main(){
int *p;
p = function_A();
function_B(p);
return 0;
}
int function_A(){
static int myArray[3];
myArray[0] = 11;
myArray[1] = 22;
myArray[2] = 33;
return myArray;
}
int function_B(int *myPointer){
// Here I just want to print my array I've got from function_A() to the
// console
printf("%d", *myPointer)
return 0;
}
function_A应该返回一个数组,而function_B应该接受这个数组。
谢谢!
https://stackoverflow.com/questions/54029347
复制相似问题