It is more troublesome to match different types. This requires a little thinking.
Invalid qsort (
Void *base,/* The first data can be regarded as the first address of the array */
Size_t num,/* Number of elements */
Size_t width,/* data size, you can use, sizeof to get */
Int (_ _ cdecl * compare) (constvoid *, constvoid *)/* comparison function, */
);
Compare functions and related requirements.
Compare ((void *)&; elem 1,(void *)& amp; elem 2); The routine must compare these elements and then return one of the following.
Values:
Comparison function return value
describe
& lt0
Elem 1 less than elem2
Elem 1 is equivalent to elem2.
& gt0
PS:
else if(strcmp(sell[i])。 Dm, sell [j]. dm==0))
I didn't see it just now. This is the problem.
& gt0
PS:
else if(strcmp(sell[i])。 Dm, sell [j]. dm==0))
...
Should be written as
else if(strcmp(sell[i])。 Dm, sell [j]. dm)==0)
...
Warning c4047: "function": "constchar *" and "int" have different indirect levels.
Sell [j] Dm==0 is an integer type.
Warning c4024: "strcmp": The types of formal parameter 2 and actual parameter 2 are different.
Because selling [j]. Dm==0 is an integer, which is inconsistent with strcmp's requirement that both parameters are const char *.
So generate a warning!
Because the pointer of C++ is actually an integer data, the type check will not be judged as an error!
Strictly speaking, it should be a mistake, not a warning! ! !
different
Indirect means, circuitous, dishonest
Regular: regular; Modal; well-behaved
Reality: true; Practical; Currently; at present
The first warning says that the function parameter types are inconsistent.
The second warning said that the second parameter of strcmp did not meet the requirements.