------------------------------------------------------------------------------
MC logo
Basic Types
[^] CSc 220 Home
------------------------------------------------------------------------------
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[Standards] [Programming Environment] [Hello, World!] [Hello Again, World!] [Identifiers] [Constants] [Average of Three] [Basic Types] [Shortcut Operators] [Increment Operators] [C++ Strings]
Generally, use int for integer values and double for floating point. The char type is one byte long for holding characters, but it is really just a small integer, holding an ASCII value.

Actually, they come in several sizes:
Integer Types: charshort intintlong intlong long int
Floating Types: floatdoublelong double

Unlike Java, sizes are not dictated by the standard, but by the compiler writer. The only restrictions are that char should be one byte, and, reading left to right, the sizes should never get smaller. They may be the same, though.

Typically int, long int and float are four bytes, with short int at two and double being eight.