What is Register variable in C

Explain Register variable in C


We can tell the compiler that a variable should be kept in one of the machine’s register, instead of keeping in the memory (where normal variables are stored).
Since a register is much faster than a memory access, keeping the frequently accessed variables (e.g. loop control variables) in the register will lead to faster execution of programs.

This is done as follows :

 register int count;

Labels: