Register variable extern external variable external function, register extern
Register variable
Ignore this.
Variables defined by the register keyword are directly placed in registers.
A register is a storage unit placed inside the CPU. It is much faster than the memory, so when the program calls the same variable for more than 10000 times, it is declared as a register variable, which will increase the execution speed of the program.
Technology development does not need to write register int I, f = 1;
Use the keyword extern for external variables
View results?
# Include <iostream> using namespace std; int fun (int x, int y); int main () {extern int a, B; cout <fun (a, B) <endl; return 0;} int a = 15, B =-7; int fun (int x, int y) {int c; c = x> y? X: y; return c ;}
External Functions
# Include <iostream> using namespace std; int fun (int x, int y); int main () {extern fun (int x, int y ); // The method int a = 15, B =-7; cout <fun (a, B) <endl; return 0;} in the external program is called ;}
Int fun (int x, int y) {int c; c = x> y? X: y; return c ;}