我有一个
此测试代码的无法将参数'1'的'gpio **'转换为'gpio *'为'void timer_hard(gpio *)'
错误:
#include <iostream>
struct gpio{
short const pin;
short must;
short flag;
}handle_out{0,0,0},handle_in{1,0,0},lock{2,0,0},mouth{3,0,0},ring_hard{4,0,0},ring_soft{5,0,0};
gpio *gpio_0[]={&handle_out,&handle_in,&lock,&mouth};
void timer_hard(gpio *array){
std::cout << sizeof(gpio_0) << '\n';
std::cout << sizeof(array) << '\n';
for (int i = 0; i<sizeof(array)/sizeof(array[0]);i++){
std::cout << array[i].pin << '\n';
};
std::cout << '\n';
for (int i = 0; i<sizeof(array)/sizeof(array[0]);i++){
std::cout << array[i].flag << '\n';
};
lock.flag = 1;
std::cout << '\n';
for (int i = 0; i<sizeof(array)/sizeof(array[0]);i++){
std::cout << array[i].flag << '\n';
};
}
main(){
timer_hard(gpio_0);
}
请告诉我我做错了什么
答案 0 :(得分:0)
gpio *gpio_0[]
是一个二维数组,这意味着它的类型为gpio **
。