main.cpp: In function ‘int main()’:
main.cpp:18:31: error: invalid conversion from ‘int (*)(void*, void*)’ to ‘__compar_fn_t {aka int (*)(const void*, const void*)}’ [-fpermissive]
qsort(ci,N,sizeof(int),cmp);
^
In file included from /usr/include/c++/7/cstdlib:75:0,
from /usr/include/c++/7/ext/string_conversions.h:41,
from /usr/include/c++/7/bits/basic_string.h:6361,
from /usr/include/c++/7/string:52,
from /usr/include/c++/7/bits/locale_classes.h:40,
from /usr/include/c++/7/bits/ios_base.h:41,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/ostream:38,
from /usr/include/c++/7/iostream:39,
from main.cpp:1:
/usr/include/stdlib.h:827:13: note: initializing argument 4 of ‘void qsort(void*, size_t, size_t, __compar_fn_t)’
extern void qsort (void *__base, size_t __nmemb, size_t __size,
^~~~~
main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&N);
~~~~~^~~~~~~~~
main.cpp:17:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
for(int i=0;i<N;i+=1)scanf("%d",&ci[i]);
~~~~~^~~~~~~~~~~~~
报错 |