• + 2 comments

    The code below works in all other test cases but show runtime error in test case#7,i don't know why.Please guide me.

    int* breakingRecords(int score_count, int* score,int* result_count) 
    {
        int max, min, up = 0, down = 0, itr;
        static int result[2];
        max = min = score[0];
        for(itr = 1; itr < score_count; itr++)
        {
            if(score[itr] > max)
            {
                max = score[itr];
                up++;
            }
            else if(score[itr] < min)
            {
                min = score[itr];
                down++;
            }
        }
        result[0] = up;
        result[1] = down;
        *result_count = 2;
        return result;
    }