Home  >  Article  >  What is the difference between void and int

What is the difference between void and int

藏色散人
藏色散人Original
2021-01-06 09:58:5634940browse

The difference between void and int: 1. Functions defined by void have no return value, while functions defined by int return integer values; 2. Functions preceded by void cannot return any data, and the return statement cannot be used , and the return value of the function preceded by int is an integer, and the return information can be directly used when the function is called.

What is the difference between void and int

#The operating environment of this tutorial: Dell G3 computer, Windows 7 system, C# version.

Recommended: "c Language Tutorial"

When defining a function, the difference between void and int: whether the function has a return value

Function defined by void There is no return value, the function defined by int returns an integer value.

Functions preceded by void cannot return any data, and the return statement cannot be used. This type of function should implement all functions that should be implemented within this function. But it's not that you can't exchange data with the outside. You can still pass data through reference parameters, but you can't directly accept the return value when calling, because there is no return value.

For functions preceded by int, the return value is an integer. It may be a number whose result is an integer, or it may be the running status, success or failure identification. When the function is called, the return information can be directly used to implement some Function.

The above is the detailed content of What is the difference between void and int. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn