C ++ variable

xiaoxiao2021-03-06  39

Variables provide us with a named memory store that can read and write it through the program. Each symbol variable in C is associated with a specific data type, which determines the size, layout of the relevant memory, the range of the value of the memory area, and the operation set can be applied. We can also speak variables into objects.

Object declaration declaring: Make the program know the type and name of the object

Object definition: Assign memory to objects. Example INT i, specify the type and identifier of the variable, but does not provide initial value.

If a variable is defined within a global scope, the system guarantees that the initial value is 0.

If the variable is defined within the local domain or dynamically assigned by the New Expression, the system does not provide the initial value 0. These objects are called uninitialized. The uninitialized object is not no value but its value is an undefined undefined part of the memory area containing a random bit string, which may be the result of previous use.

Comparative approach is not to provide a separate declaration in each file file, but declare this object in a header file, and then contain this header file when you need to declare the object. According to this approach, if you need to modify the object, you only need to modify a consistency that can be declared in a file that uses the object once.

Variable Name: 1, must start with letters, underscore; 2, variable name consisting of letters, numbers, underscores; , Constant names in Index.

转载请注明原文地址:https://www.9cbs.com/read-67394.html

New Post(0)