Description of problem scenario: Leetcode encountered this kind of error when scanning the question, the code was no problem, but the compilation failed, it was very suspicious of life.
problem solved: add a return statement at the end of the function, as long as the return data type pair! Remember, always return, even if you never need it.
although sometimes we have a return in the same program, but not at the end of the code, leetCode will not compile.
So we also have to return at the end of the function block. When this error occurs, LeetCode usually has a red highlight on the last line of the function block.
(Although I thought of adding the return value, I silently said to myself that it was clearly written in the middle, but there is no use in adding here…)
As shown in figure:
Read More:
- control reaches end of non-void function
- Front end project runtime prompts syntax error: typeerror: token.type.endswith is not a function solution
- Solve the problem that TeamViewer reaches the maximum number of devices
- The back end cannot receive the parameters passed by the front end
- Nginx front end and back end separation + service cluster reverse proxy
- Record the pits you stepped on – NSS error – 5938 (PR_ END_ OF_ FILE_ ERROR), curl: (35) Encountered end of file
- Deep learning: derivation of sigmoid function and loss function
- Golang timer function executes a function every few minutes
- Python’s json.loads Invalid control character
- Error: transfer of control bypasses initialization of: variable XXX solution
- Python – get the information of calling function from called function
- Ioremap function and iounmap() function
- Latex bracket size control
- Split keyword in ABAP when the separator is at the beginning and end of the string
- Undefined control sequence
- The solution of flashing back after the end of console program running
- Job for network.service Failed because the control process exited with error code. See “SystemC
- On the problem that VTK + QT process can’t end after closing the program
- Solve the unexpected end of stream exception thrown by jedis
- Solve the problem: Something’s wrong–perhaps a missing \item. \end{thebibliography}