错误C2143:语法错误:缺少';' 之前')'

use*_*390 1 c

//Program Written By: Andre Chitsaz-zadeh
//Program Written On: 10/7/12
//Program calculates book cost for multiple book orders. 
//Program written using multiple functions.

#include <stdio.h>
#define SIZE 5

void inputData();
void processingData(int costs[]);
int costs[5];

int main ()
{
    inputData();
    processingData(costs);
}

void inputData()
{
    int i = 0;
    printf( "\nPlease enter five products costs.\n" );
    while(i < 5)
    {
       scanf("%d", &costs[i]);
       i = i + 1;
    }
    printf("stuff");
    for (i = 0, i < 5, i++)
        printf("%d\n", costs[i]);
}

void processingData(int costs[])
{
     int i;
     for (i = 0; i < 4; ++i)
     {
          int j, min, temp;
          min = i;
          for (j = i+1; j < 5; ++j)
          {
               if (costs[j] < costs[min])
                    min = j;
          }

          temp = costs[i];
          costs[i] = costs[min];
          costs[min] = temp;
     }
}
Run Code Online (Sandbox Code Playgroud)

它在撒谎......我没有错过任何一种分号.我已经在程序的这一点上停留了一段时间,似乎我错过了一些愚蠢的东西.我得到这个错误的唯一一次是当我丢失分号并且我已经多次彻底检查了我的程序...谢谢!

Ode*_*ded 11

编译器不撒谎.

在你的inputData功能:

for (i = 0, i < 5, i++)
Run Code Online (Sandbox Code Playgroud)

应该:

for (i = 0; i < 5; i++)
Run Code Online (Sandbox Code Playgroud)

奇怪的是,你在你的processingData函数中得到了for循环.

  • @ user1724390:开始注意到编译器错误通常带有行号,这些行号可以帮助您找到它所抱怨的代码中的位置? (8认同)