Technology (Read Only) > Programming

Feel like a dumbass (C / C++)

(1/1)

Travelsonic:
Was messing around today, and I learned something new - annoyingly, seemed like something I should have known a long time ago.

Chars can be displayed as either just that - single characters - or integers, right?  How did I not know that force casting it to a boolean pointer [ex: outputting it like "cout << (bool*)someChar << "\n"; " would display the hexadecimal value?

Shit, this will make programming projects where I work with data in hexadecimal a bit easier to work with so far as displaying it, etc.

Navigation

[0] Message Index

Go to full version