top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are register variables?

+5 votes
301 views

What are register variables? What are the advantages of using register variables?

posted Nov 9, 2013 by Mona Sharma

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+2 votes

If a variable is declared with a register storage class,it is known as register variable.The
register variable is stored in the cpu register instead of main memory.Frequently used variables
are declared as register variable as it’s access time is faster.

answer Nov 9, 2013 by Vikas Upadhyay
+1 vote

Yes as explained by Vikas it is right some more point i want to add
1.we can not access address of register variable as register don't have any address.
2.We can't use this also in global scope.

answer Nov 9, 2013 by Sachidananda Sahu
Similar Questions
+5 votes

You can find three principal uses for the static. This is a good way how to start your answer to this question. Let’s look at the three principal uses:

  1. Firstly, when you declare inside of a function: This retains the value between function calls

  2. Secondly, when it is declared for the function name: By default function is extern..therefore it will be visible out of different files if the function declaration is set as static..it will be invisible for outer files

  3. And lastly, static for global parameters: By default you can use global variables from outside files When it’s static global..this variable will be limited to within the file.

is this right ?

+2 votes

How can I wwap value two variables without using third variable or +/- operator?

...