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

Program that will recursively prompt for input from the user, BACKGROUND: F...

BACKGROUND: FILE SYSTEMS  In a computer, a file system (sometimes written filesystem) is the way in which files are named and where they are placed logically for storage and ret

Explain the use of functions in c++ programs, Question: (a) Write shor...

Question: (a) Write short notes on arrays. Extend your answer by putting emphasis on memory allocation. (b) Write a C++ program to input an integer n followed by n real-

Flow chart, flow chart for prime or not

flow chart for prime or not

Console atm machine coding, construct a console programme for a bank ATM m...

construct a console programme for a bank ATM machine.

Recursion, #questiowrite a program to calculate e^x

#questiowrite a program to calculate e^x

Padovan string , .write a program that counts the number of occurrences of ...

.write a program that counts the number of occurrences of the string in the n-th padovan string p(n)   program in java // aakash , suraj , prem sasi kumar kamaraj college

How private instance of a class can be assigned values, Question 1: (a)...

Question 1: (a) Explain clearly the following concepts using suitable examples of your own:- (i) concrete class v/s abstract class (ii) constructor v/s over

Stuctrue , To store a date use a structure that contains three members date...

To store a date use a structure that contains three members date, month and year. If the dates are equal then display message “Equal” otherwise “Unequal” Program structure: main()

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