Explain register variable, C/C++ Programming

Assignment Help:

Explain Register Variable

Computers have internal registers, which are used to keep data temporarily, before any operation can be performed. Intermediate results of the calculations are also stored in registers. Operations can be performed on the data stored in registers more quickly than on the data stored in memory. This is because the registers are a part of the processor itself. If a certain variable is used often - for instance, the control variable in a loop can be assigned a register, rather than a variable. This is done using the keyword register. Though, a register is assigned by the compiler only if it is free, otherwise it is taken as automatic. Also, global variables cannot be register variables.

e.g.

                void loopfn()

                 {

                  register int i;

                                for(i=0; i< 100; i++)

                                 {

                                                cout << i;

                                 }

                 }

 


Related Discussions:- Explain register variable

Artificial block, What if I cannot wrap the local in an artificial block? n...

What if I cannot wrap the local in an artificial block? need help on Artificial Block in c++.

Integration, to find the area under the curve y = f(x) between x = a and x ...

to find the area under the curve y = f(x) between x = a and x = b

Assignment, Classify computer systems according to capacity. How they are d...

Classify computer systems according to capacity. How they are different from computers according to the classification of technology. Provide comparative study also.

Area under curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Flowcharting., flowcharting of 3 quizes display the average

flowcharting of 3 quizes display the average

Explain the ways of initializing the arrays, Various ways of initializing t...

Various ways of initializing the Arrays. - The for loop initializes 10 elements with the value of their index.      void main()     {                 const in

How can one make it so keys pressed through users are , How can one make it...

How can one make it so keys pressed through users are not echoed on the screen? A: It is not a standard C++ feature. C++ doesn't even need your system to have a keyboard or a sc

Luminous Jewels - The Polishing Game, Byteland county is very famous for lu...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Define external storage class - computer programming, Define External Stora...

Define External Storage Class - computer programming? When a variable is declared outside a function the storage is permanently assigned to it and its storage class is 'extern'

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd