我知道这个问题有很多例子,但我想不通。这是一个非常简单的问题,但我正在努力解决它。起初我以为这是我编写 for
循环的方式,但在重写它并从另一个编译的文件中复制它之后,我仍然有问题。我查看了前面几行,但找不到任何打开的 {
、[
或 (
。我换出了 CHAR_NUM
257
但仍然没有骰子。问这个我感觉很不好,因为我知道这会很愚蠢,但我想不通。
这里是错误:
35: error: expected ')' before ';' token
错误代码如下:
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include "tree.h"
#define CHAR_NUM 257
void countChars(int *, FILE *);
void makeTrees(int *, struct tree *);
struct tree *makeQueue(struct tree *);
int arrayFilled(struct tree *);
void findSmallest(struct tree *, struct tree *, struct tree *);
int main (int argc, char **argv)
{
assert(argc == 3);
int *charCounts, *bitList;
FILE *big, *small;
struct tree *charList, *heap;
int i;
assert((charCounts = malloc(sizeof(int) * CHAR_NUM)) != NULL);
assert((charList = malloc(sizeof(struct tree) * CHAR_NUM)) != NULL);
assert((big = fopen(argv[1], "r")) != NULL);
assert((small = fopen(argv[2], "wb")) != NULL);
while (i = 0; i < CHAR_NUM; i++) //This is the line with the error
{
charCounts[i] = 0;
}
...
最佳答案
这是 for
循环的格式,而不是 while
循环的格式。您想要以下内容:
for(i = 0; i < CHAR_NUM; i++) //This is the line with the error
{
charCounts[i] = 0;
}
关于c - 错误 : expected ')' before ';' token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23961823/