I have a question about C language.
In the qsort
assignment, I submitted the following code:
printf("a order:");
scanf("%c", & ad);
qsort(sin,9,sizeof(int), ad=='a'?cmp_u:cmp_d);
'a'?cmp_u:cmp_d);
I was told to write separately using the if
statement, but I got an error...
Could someone tell me how to write it?
if(ad=='a')
qsort(sin,9,cmp_u);
else
qsort(sin,9,cmp_d);
qsort(sin,9,sizeof(int), ad=='a'?cmp_u:cmp_d);
If you want to rewrite this ↑ to use cmp_u
, for example,
qsort(sin,9,sizeof(int),cmp_u);// Same
Shouldn't it be?
(According to your description, there are three arguments.)
© 2024 OneMinuteCode. All rights reserved.