【发布时间】:2013-08-24 15:49:17
【问题描述】:
我收到了错误:
']' 标记之前的预期主表达式
在这一行:
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;
}
}
}
【问题讨论】:
-
这不是将表传递给函数的正确方法。