Course Content
Programming in C
About Lesson

We can declare a heavily used variable as register. The idea being that these variables will be placed in processor registers, making them faster to use. But compilers are free to ignore the register keyword.

register int x;
register char c;

Register declarations can only be applied to automatic variables and formal parameters of a function. Example:

int factorial(register int num) { ... }

Only a few variables of specific types in each function may be kept in registers, depending on the machine.

Scroll to Top