bool compare(i64 *a, i64 *b)
{
if (*(a + 1) != *(b + 1))
{
return *(a + 1) > *(b + 1);
}
else
{
return *a < *b;
}
}
int main(){
i64 final[100][2] = {
0,
};
i64 final_stack = 0;
//....(after inserting data)
sort(final, final + final_stack, compare);
}
< /code>
Я не могу сортировать int массив, как это. The compiler error says, there is problem with "compare" function.
I tried,
- bool compare(const i64 *a, const i64 *b)
- bool compare(void *a, void *b)
Подробнее здесь: https://stackoverflow.com/questions/787 ... -int-array
Мобильная версия