473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

difference between these TWO Declerations

Hi...
I want to know difference between these two declaration in C language..

register int i;
int _i;
Jul 9 '07 #1
5 1146
Hi...
I want to know difference between these two declaration in C language..

register int i;
int _i;
Jul 9 '07 #2
Meetee
931 Expert Mod 512MB
Hi...
I want to know difference between these two declaration in C language..

register int i;
int _i;
"register" is keyword used to give a hint to the compiler as to how to generate code. In this case, you are asking the compiler to try to keep a variable in a register instead of in memory. Registers can be accessed much faster than memory locations.

Regards
Jul 9 '07 #3
"register" is keyword used to give a hint to the compiler as to how to generate code. In this case, you are asking the compiler to try to keep a variable in a register instead of in memory. Registers can be accessed much faster than memory locations.

Regards
Register is only a request to the compiler....
adding register keyword doesnt guarantee, that the variable goes into the register.

Basically used in embedded programing for faster access of the variables
Jul 9 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
_i and i are both int variables.

The register suggests to the compiler that ti would be better to keep the variable in a processor register rather than in memory. The compiler is free to ignore the suggestion.

You never use the register keyword unless you really know what you are doing
Jul 9 '07 #5
Silent1Mezzo
208 100+
Also please do not double post.
Jul 9 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Hans Gruber | last post by:
Hi all, I have been struggling with a problem all day, I have been unable to come up with a working solution. I want to write a function which takes 2 unix timestamps and calculates the...
11
by: Shea Martin | last post by:
I have been programming in C++ for over 4 years. I *think* I knew that a struct could have a constructor but I decided to dig into it a little more today, and found that there is very little...
24
by: wwj | last post by:
Hi ,all I want to know the difference between char a and char *p=new char and the difference between the heap and the stack ,and if the char a is corresponding to the stack in MEMORY,and char...
10
by: tinesan | last post by:
Hello fellow C programmers, I'm just learning to program with C, and I'm wondering what the difference between signed and unsigned char is. To me there seems to be no difference, and the...
4
by: SAI | last post by:
Both have "TextBox" element and "Runat server". I don't understand the difference. Please advise. Thanks.
5
by: vivekian | last post by:
Created a class , which is declared within a namespace . namespace mySpace { class X { /* members */ } This class task is to be used by another class Y , 'using namespace mySpace' directive.
7
by: Bart_D | last post by:
Hi, Can anybody explain me what's the difference between for example: imports system.data implements ICallbackEventHandler inherits System.Web.UI.Page Thanks Bart
1
by: poojagupta | last post by:
What is the difference between 1. const char * s; and char const *s; 2.const char *const s; and char const *const s; Though as far as I searched the web n books I always find answer as "there is...
5
by: iceman19860106 | last post by:
hello everyone! what is the difference between NULL and 0 in C language?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.