Register Variable Class
Register Variable class
· It stores variables in Register memory
· Default value of register variables is garbage value.
· Scope of register variables is also local to block.
· Life of variables is also remains till control remains in block.
· Values stored in register access more faster than values stored in memory
· So if a variable is used at many places in program, it’s better to declare its storage class as register. So it will increase the performance of program.
· CPU registers are limited. So during execution of program, value may be stored in register, because register may be busy doing another CPU tasks. At that time those variables will also works as auto variables.
· Keyword - register
main() { register int i; printf(“%d”,i); } |
Comments
Post a Comment