在c++(avr-g++)中调用方法时是否可以内联初始化整数数组?
这是我尝试过的:
A({2, 4, 8, 3, 6});
void A(int* b) {
}
我得到了这个错误:
cannot convert '' to 'int*' for argument '1' to 'void A(int*)' cannot convert '' to 'int*' for argument '1' to 'void A(int*)'
最佳答案
看着我的老问题,我发现我现在真的知道这个问题的答案了。开始了:
void A(int *b) {
}
void foo() {
A((int[]){1,2,3});
}
关于c++ - 将参数传递给方法时内联初始化整数数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32632877/