Jump to content
  • Advertisement
Sign in to follow this  
jordi_0071

sizeof() more then just 1?

This topic is 4946 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Quote:
Original post by jordi_0071
hey, this piece of code: aChar = sizeof (char); will print a smiley and is character 1, but can i print for example character 2 with sizeof? if its possible then how?


Do you want to display how big a type is in terms of chars ?
Why not use:
aChar = '0' + sizeof(char);

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by nmi
Do you want to display how big a type is in terms of chars ?
Why not use:
aChar = '0' + sizeof(char);


Works great (for most character sets anyway) until the size gets bigger than 9...

jordi needs to expand on his post a bit since printing and sizeof have pretty much absolutely nothing to do with each other.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!