Example for register storage class - computer programming, C/C++ Programming

Assignment Help:

Example for Register Storage Class - computer programming?

main()
{
register int i;
for (i=0; i< LIMIT; ++i)
{
...............
...............
}
} /* block exit will free the register.*/

Although we have declared the storage class ‘i' as register we can't say for sure that the value of i would be stored in a CPU register because the number of CPU registers are limited. And they perhaps busy doing some other work. In such situations the variable works as if its storage class in 'auto'. For all time remember that a register declaration is taken only as advice to the compiler.

We can't use register storage class for all kinds of variables. The subsequent declarations are not correct.

register float q;
register double a;
register long c; 

This is for the reason that the CPU registers in a microcomputer are typically 16 bit registers and therefore cannot hold a float or double value which requires 4 and 8 values respectively. It would not give any error message, other than works as auto storage class.


Related Discussions:- Example for register storage class - computer programming

Which constructor gets called while i create an array of , Which constructo...

Which constructor gets called while I create an array of Fred objects?

Polishing game, Byteland county is very famous for luminous jewels. Luminou...

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

Program, program to check whether a given point lies inside a rectangle or ...

program to check whether a given point lies inside a rectangle or not

Explain the shift operators, The Shift Operators There are 2 shift oper...

The Shift Operators There are 2 shift operators : left shift ( >). These are binary operators. The format is                 operand >> number or operand   The first

Flow chart, obtain two numbers from thekey board,and determain and display(...

obtain two numbers from thekey board,and determain and display(if either)is the larger of two numbers.

Programming Assignment 4, For this program, you are going to modify your pr...

For this program, you are going to modify your previous program (program 3) so that it will now have a menu to see if the user wants to read the input from a file or interactively.

Usb photobackup, Project Description: Prepare software that will work with ...

Project Description: Prepare software that will work with our USB hardware that easily lets you backup all the pictures in your computer into the USB stick in one single step. Once

Describe spaghetti programming, Describe spaghetti programming. - Spagh...

Describe spaghetti programming. - Spaghetti programming refers to codes which tend to get tangled and overlapped throughout the program. - It makes a program complex and ana

What is b-tree, B-tree: A B-tree is an also called balanced m-way tree. A ...

B-tree: A B-tree is an also called balanced m-way tree. A node of the tree may have many records or key and pointers to children. It is also called as the balanced sort tree. It s

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