#pointer to unsigned type

25 messages · Page 1 of 1 (latest)

tacit ridge
#

if I have a pointer to an unsigned type, does the address need to be unsigned as well? like for example if i did unsigned int* x = 0x.....

do I need the address to be unsigned? or would i be warning free

midnight cradleBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

worn peak
#

and yes, your pointer type needs to match what it's pointing to

tacit ridge
#

ohhh

#

gotcha i was confused

#

so the value of * is just a signed int?

#

or is it an unsigned int

worn peak
#

"the value of *" ??

tacit ridge
#

a pointer is sugned or unsigned?

#

or does it not matter

worn peak
#

I think technically they're neither, but in practice they're unsigned

#

what would a negative memory address mean

tacit ridge
#

yea thats why im confused lol

#

so lets say i define a pointer

#

and i want to set it to a direct address

#

do i need to do like 0x....U?

worn peak
#

no

#

but there are very few reasons to be manually defining an address like that

#

if you find yourself doing that, take a step back and consider what you're doing

worn peak
dusty wasp
tacit ridge