Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the difference between static int and int in C language?
What is the difference between static int and int in C language?

1. Different functions

1. static int: Add the static keyword, and the member declared in this way is called a static member, which is used to define static int type variables. 2. int: is an identifier used to define integer type variables.

2. Different characteristics

1. static int: The existence does not depend on the existence of any class object. The static data members of the class should be explicitly initialized in the code

p>

2. int: int occupies 4 bytes, 32 bits, and the data range is -2147483648~2147483647[-2^31~2^31-1].

3. Different creation methods

1. static int: Belongs to the entire class. Even if no object is created, the static data member variables of the class still exist.

2. int: a specific object belonging to the class. Only when the object is created, ordinary data members will be allocated memory.

Baidu Encyclopedia-static

Baidu Encyclopedia-INT