answersLogoWhite

0


Best Answer

The register keyword tells the compiler to store the variable onto the CPU register if space on the register is available. The reasoning is that register operations are always faster than memory operations and thus if used correctly, it can speed up an algorithm. However, the register keyword is a somewhat antiquated procedure since for quite a long time the optimizer in modern compilers are smart enough to detect when storing a variable on the register will be advantageous and will do so during optimization. There for, suggesting to the compiler to store a variable on the register can only make things slower if used incorrectly.

The register keyword tells the compiler to store the variable onto the CPU register if space on the register is available. The reasoning is that register operations are always faster than memory operations and thus if used correctly, it can speed up an algorithm. However, the register keyword is a somewhat antiquated procedure since for quite a long time the optimizer in modern compilers are smart enough to detect when storing a variable on the register will be advantageous and will do so during optimization. There for, suggesting to the compiler to store a variable on the register can only make things slower if used incorrectly.

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the use of register keyword in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp