Current location - Recipe Complete Network - Complete cookbook - What do C++ functions and variables mean?
What do C++ functions and variables mean?
On the computer, there are many programming languages for everyone to use. The following explanations are applicable to but not limited to C++ language. I don't need a score.

Function: A method of obtaining output based on some input. Defining a function is to define the method of processing input, just as defining a recipe is to define the cooking method of a dish; Function has input conditions, just like cooking needs raw materials; Functions have function bodies, just like the specific steps of cooking; The function does not return the result, just like there is always something cooked when cooking.

Variable: A place where something is kept. Define a variable, which can store the numerical value needed for calculation and update this value when necessary, just like a schoolbag can hold stationery books and can be used or replaced when necessary; Variables have living space, beyond which they cannot be read and updated, just as stationery cannot be used without schoolbags. Variables take up storage space, and if they are not needed, they will take up resources, just like a schoolbag with unused things will take up space.