开发者

ERROR: expected expression before "{"

开发者 https://www.devze.com 2023-03-09 14:43 出处:网络
The second line in the function triggers the error. void read_word(int counts[25]) { counts[25]={0}; int b;

The second line in the function triggers the error.

void read_word(int counts[25])  
{   
    counts[25]={0};  
    int b;  
    char a;  
    scanf("%c", &a);  
    while(isalpha(a) )  
    {  
     开发者_Python百科   b= a -97;  
        counts[b]++;  
        scanf("%c", &a);  
    } 
}


You cannot initialize the array not during declaration: (counts[25]={0};).

Also, this: void read_word(int counts[25]) is treated as void read_word(int *counts) which means the compiler will not know what is the size of the array...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号