error C2059: Syntax error: "Type"

Today, in the process of learning pointers, I wrote a lot of code. Since most of them are function calls, I did not comment out or delete the previous functions when I wrote a paragraph. When writing to dynamic memory allocation, a new header file stdlib.h needs to be introduced. At this time, an error occurs when my code runs. The error is as follows

image.png

code show as below:image.png

I checked it on the Internet and found that the max function was originally defined in stdlib.h. As a result, the two functions have the same name, so an error occurred during operation.

Solution 1: Change a name to your max function,

Solution 2: If the max function is not used, comment out or delete it.

It is worth noting that it is not only the function name max that will make mistakes, similar min will also make mistakes.

Record it and pay attention next time!

Guess you like

Origin blog.51cto.com/15098794/2664655
Recommended