創建結構的數組我有我的代碼如下結構:的Arduino在結構
struct digitalDataStruct {
unsigned long timestamp;
int digitalData;
};
struct analogDataStruct {
unsigned long timestamp;
int analogData[16];
};
struct structWithPositionAndCo {
const int sizeOfDigital = 1000;
const int sizeOfAnalog = 10;
digitalDataStruct sensorValuesDigital[];
analogDataStruct sensorValuesAnalog[];
int digitalPosition = 0;
int analogPosition = 0;
int lastDigitalWriteToPC = 0;
int lastAnalogWriteToPC = 0;
};
現在我想創建digitalDataStruct和analogDataStruct的陣列。
structPackage.sensorValuesAnalog = new analogDataStruct[structPackage.sizeOfAnalog]; // array to store the value coming from the sensor
structPackage.sensorValuesDigital = new digitalDataStruct[structPackage.sizeOfDigital]; // array to store the value coming from the sensor
但我仍然得到這個錯誤:
incompatible types in assignment of 'analogDataStruct*' to 'analogDataStruct [0]'
任何線索?
什麼是'structPackage'? –
structPackage是structWithPositionAndCo的對象 –