Finding max value in an array

后端 未结 5 937
闹比i
闹比i 2021-01-07 13:57
int highNum = 0;
int m;
int list[4] = {10, 4, 7, 8};
    for (m = 0 ; m < size ; m++);
    {
        if (list[m] > highNum)
            highNum = list[m];
             


        
5条回答
  •  清酒与你
    2021-01-07 14:35

    You have a semicolon after your for statement:

    for (m = 0 ; m < size ; m++);
    {
    

    This should be:

    for (m = 0 ; m < size ; m++)
    {
    

提交回复
热议问题