By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,159 Members | 952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,159 IT Pros & Developers. It's quick & easy.

Puzzel in C

P: 1
Hi
I am Gayatri from India.

My question is
If we declare any variable in C and try to get
the address of that same variable then we are getting
any unsigned integer value.
But if we do the same job in C++ then we are getting
the Hexadecimal numbers Why .....?

Gayatri Mishra
Jun 9 '07 #1
Share this Question
Share on Google+
2 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
It's the same in C++. Addresses are unsigned int.

Probably this is your IDE and the debugger is set to show values in hex.
Jun 9 '07 #2

AdrianH
Expert 100+
P: 1,251
Hi
I am Gayatri from India.

My question is
If we declare any variable in C and try to get
the address of that same variable then we are getting
any unsigned integer value.
But if we do the same job in C++ then we are getting
the Hexadecimal numbers Why .....?

Gayatri Mishra
In what context are you referring to? It doesn't make any sense. A hex number can represent an unsigned int and the other way around.

A pointer is very much like an unsigned int, but in C++ which uses a strongly typed system, you cannot just assign a int to a pointer or vice-versa.

Can you clarify what you are asking?


Adrian
Jun 10 '07 #3

Post your reply

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