Solve the C language function call warning: implicit declaration of function ''

This error suddenly broke out when I was learning function calls today, and it was successfully resolved after consulting, so I will share it with you here.

Problem: warning: implicit declaration of function ''

insert image description here

Cause of error:
It is very likely that this type of error is caused by a mistake when calling the function. Generally, the common cause of error is that the main function is written first (the main function is at the top), and then other functions are called in the main function, but if you call it like this The main function is run first, but the other function names in the main function cannot be recognized by the system at runtime, so an error is reported.

Solution:

  • write the main function at the end
  • Use function declarations (detailed below)

Function declaration:
The function should be defined first and called later, but if you insist on implementing calling first and defining later, you need to add a declaration of the function.

Function declaration format: 函数首部;
//Don't forget the semicolon, it is a feature, and you can also selectively omit the formal parameters (only use the data type)

insert image description here

Guess you like

Origin blog.csdn.net/xiaobai729/article/details/127138269