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

Algorithm, for different operation multiple stack

for different operation multiple stack

Recursive function, Write a recursive function recursiveMin that takes an i...

Write a recursive function recursiveMin that takes an integer array, a starting subscript and an ending subscript as arguments, and returns the smallest element in the array. The f

Html, world wide web

world wide web

Vb.net, write a program that would accept the radius of the sphere and retu...

write a program that would accept the radius of the sphere and return its surface area.

Write a program that reads data from array, Write a program that reads data...

Write a program that reads data into an array of type int. You must use an array. The numbers input are attendance numbers at a conference. Keep a running average, number of events

Calculating interest, The interest charged on a loan banking facility is ca...

The interest charged on a loan banking facility is calculated based on principal amount, rate and time. implement a C program that can be used to automate the calculation of the in

Padovan.., count the number of string in n-th padovan string

count the number of string in n-th padovan string

Differentiate between the expression ++a and a++, Differentiate between the...

Differentiate between the expression "++a" and "a++"? - With ++a, increment happens first on variable a, and resulting value is used. This is known as prefix increment. - Wi

Radix, a popular joke among computer is to say............

a popular joke among computer is to say............

C program for 5 function of vowels, C Program for 5 FUNCTION OF VOWELS, CNT...

C Program for 5 FUNCTION OF VOWELS, CNT_WORDS, REVERSE void input(char a[]); void output(char a[]); void reverse(char a[], char b[]); char poli(char a[], char b[]);

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