Hi...
I want to know difference between these two declaration in C language..
register int i;
int _i;
"register" is keyword used to give a hint to the compiler as to how to generate code. In this case, you are asking the compiler to try to keep a variable in a register instead of in memory. Registers can be accessed much faster than memory locations.
"register" is keyword used to give a hint to the compiler as to how to generate code. In this case, you are asking the compiler to try to keep a variable in a register instead of in memory. Registers can be accessed much faster than memory locations.
Regards
Register is only a request to the compiler....
adding register keyword doesnt guarantee, that the variable goes into the register.
Basically used in embedded programing for faster access of the variables
The register suggests to the compiler that ti would be better to keep the variable in a processor register rather than in memory. The compiler is free to ignore the suggestion.
You never use the register keyword unless you really know what you are doing
Comment