Public Group

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

## 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 on other sites
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 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 on other sites
Quote:
 Original post by Simpsons4261I'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 on other sites
oh, ok I guess I'm reading an old tutorial.

##### Share on other sites
Quote:
 Original post by CarlosNYMoh, ok I guess I'm reading an old tutorial.

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

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013753
×