The register keyword declares a block-scope variable with automatic storage duration while forbidding use of the & operator on that variable. The restriction lets the compiler see that the variable cannot be reached through an address. section 13.2.2
A local register variable
void work(void) { register int counter; counter = 0; } The declaration keeps counter within the function's automatic-storage rules. Writing &counter is not allowed, so counter cannot alias another object through a pointer. section 13.2.2
TAKEAWAY
- A register variable is created when execution enters its defining block and destroyed when execution leaves it, except where variable-length arrays or temporary objects change the case. section 13.2.2
- Each recursive call creates a separate local instance of an automatic register variable. section 13.2.2
- Declaring suitable local variables as register can expose address-taking sites and may help optimization by inhibiting aliasing. section 13.2.2 section 15.0
Arrays require separate care because they decay to the address of their first element in almost all contexts. The register technique therefore works best for non-array variables that contain no arrays. section 13.2.2

