In the C programming language, <code>register</code> is a reserved word (or keyword), type modifier, storage class, and compiler hint to store a symbol in a CPU register.
<code>register</code> is a keyword in C, and formerly in C++. The <code>register</code> keyword was deprecated in C++, and later removed (but remains reserved) in C++17. It suggests that the compiler stores a declared variable in a CPU register (or some other faster location) instead of in random-access memory. If possible, depending on the type of CPU and the complexity of the program code, it will optimize access to that variable and hence improve the execution time of a program. In C (but not C++, where the keyword is essentially ignored), the location (address) of a variable declared with <code>register</code> cannot be accessed, but the <code>sizeof</code> operator can be applied. Aside from this limitation, <code>register</code> is essentially meaningless in modern compilers, due to optimization which will place variables in a register if appropriate, regardless of whether the hint is given.
For programming of embedded systems, <code>register</code> may still be significant; for example, the Microchip MPLAB XC32 compiler allows the programmer to specify a particular register with the keyword; however, this is discouraged in favor of the compiler's optimizations.
When used, <code>register</code> is typically for loop counters, or possibly for other very frequently used variables in the code.