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

Define the data types of c language, Define the Data Types of c language? ...

Define the Data Types of c language? The C has a concept of 'data types' which are used to define a variable before its use and the definition of a variable will assign storage

I want application to generate premium, Project Description: We want to ...

Project Description: We want to generate premium numbers for one of our application. What we need is: A program that generate 2, 3, 4, 5, 6, 7, 8 digits premium numbers

Program simulate a metropolitan subway train, You're going to simulate a me...

You're going to simulate a metropolitan subway train.  The train system will start out at Station #1, or Home  Station, and will service multiple stations along its route.

Looping, For Loop with inner loop

For Loop with inner loop

Record of student and calculating marks using ctotal, reocord of a student ...

reocord of a student and a function ctotal to calculate the marks of any three subject by using ctotal() function

Operation on list - c++ program, Operation on list - c++ program: Writ...

Operation on list - c++ program: Write a program in c to Insert value on list and list iteration. typedef struct item *node_ptr; struct item {                   int e

Heating and thermodynamic, i want software to calculate heating or use ther...

i want software to calculate heating or use thermodynamic equation , pleas help me

Explain difference between early binding and late binding, What is the diff...

What is the difference between early binding and late binding? What are advantages of early binding? a.) Late binding refers to function calls which aren't resolved until run t

What is friend functions, Friend Functions One of the major features of...

Friend Functions One of the major features of OOP is information hiding. A class encapsulates data and methods to operate on that data in a single unit. The data from the class

Stack, write a simple c++ program to implement a stack: 1. push 2. pop

write a simple c++ program to implement a stack: 1. push 2. pop

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