Jump to content
  • Advertisement
Sign in to follow this  
Simpsons4261

Confusion Thread

This topic is 3981 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

I too like CarlosNYM am just learning C++ and I'm going to be using this thread to post my questions when I get confused, so hopefully you guys can help me... My first question is with variables. I understand int or integers, and that they are just any number pretty much. One thing about them can they be decimals? Next with variables, I don't really understand the char, short int, long int, bool (although the tutorial hasn't really taught me much about booleans), float (floating point number), double, long double, and wide character. I also don't get the difference between unsigned and signed variables. If you could explain to me what all of those are or what the differences are that would be GREAT! Thank you very much for your time!

Share this post


Link to post
Share on other sites
Advertisement
Doubles, floats, etc are numbers with a decimal points. Floats have a lower maximum value than doubles. A boolean is a value that can either be true (aka 1) or false (aka 0).

Share this post


Link to post
Share on other sites
Hehe, noob helpin a noob. But i guess im a little less noobish than you.

^what he said and, signed variables can be both negative and positive going from -32,768 to 32,767 while an unsigned variable can only be positive and go from 0 to 65,535.

Share this post


Link to post
Share on other sites
Quote:
Original post by Simpsons4261
I'm going to be using this thread to post my questions when I get confused, so hopefully you guys can help me...


You're better off starting a new thread for each specific question, with a thread title that explains the question. Makes it more likely people will answer and easier for other people with the same question to find answers.

Regarding variable types, try not to get too caught up in the maze of different types yet - int, char and bool are probably the most important ones to get your head round first.

@CarlosNYM - those limits you provide for signed and unsigned ints apply to 16 bit integer types. These days the native int size for the vast majority of compilers is 32 bit. The ranges are signnificantly larger (something like nought to 4 billion for an unsigned 32 bit in if memory serves). Plus the move is now being made to 64 bit compilers.

Bear in mind that no C++ standard makes any guarantees about the sizes of ints, short ints, long ints etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by CarlosNYM
oh, ok I guess I'm reading an old tutorial.


Are you still using the teach yourself c++ in 21 days tutorial?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!