我收到错误:
']' 标记之前的预期主表达式
在这条线上:
berakna_histogram_abs(histogram[], textRad);
有人知道为什么吗?
const int ANTAL_BOKSTAVER = 26; //A-Z
void berakna_histogram_abs(int histogram[], int antal);
int main() {
string textRad = "";
int histogram[ANTAL_BOKSTAVER];
getline(cin, textRad);
berakna_histogram_abs(histogram[], textRad);
return 0;
}
void berakna_histogram_abs(int tal[], string textRad){
int antal = textRad.length();
for(int i = 0; i < antal; i++){
if(textRad.at(i) == 'a' || textRad.at(i) == 'A'){
tal[0] + 1;
}
}
}