What is the difference between auto variable and register variable in C?

C Programming Language >   Variable in C Language >   Storage Class in C  

Short Question

2462


Answer:

Storage class of all variables are auto by default unless we specify a variable is register or static or extern in C program.

  • Both auto variable and register variable are local variables. Register variables are stored in register memory. Whereas, auto variables are stored in main CPU memory.
  • Register variables will be accessed very faster than the normal/auto variables since they are stored in register memory rather than main memory.
  • But, only limited variables can be used as register since register size is very low. (16 bits, 32 bits or 64 bits)


This Particular section is dedicated to Question & Answer only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.