âšī¸ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 2.3 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://courses.washington.edu/css342/zander/css332/datatypes.html |
| Last Crawled | 2026-02-07 00:06:20 (2 months ago) |
| First Indexed | not set |
| HTTP Status Code | 200 |
| Meta Title | C/C++ data types, basic operators, and control structures |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | Data types
Data types in C++ are similar to Java. There are ints, floats, doubles, etc.
In C++ it's bool instead of boolean. There are long and short ints
although you are not assured of the number of bytes for each.
There are also signed and unsigned ints. Unsigned ints can only hold
ints >= zero.
Some operations are not completely defined,
e.g., division involving negative numbers, so it is possible
to get different answers using different compilers.
You shouldn't have problems though with the computations in your courses.
Characters are similar with literals in single quotes.
The char type in C++ does not have a specified byte size
although they are typically stored in 8 bits.
String terminology can be ambiguous.
There is a
string
class with all the
usual functionality, but C/C++ programmers also refer to char
arrays as strings. If you have an
array of char, always store the NULL character, '\0' as the
final character of the string. If you do this, then you
can traverse and compare char by char, but you can also
use the whole thing as you would a string object for I/O,
e.g., if   s   is a valid char array, cout
Note that when initializing on the declaration, the '\0' char
will automatically be stored. So the following char array
will have six elements:
char s[] = "hello";
Basic operators
The basic operators are the same as in Java, e.g., +, -, *, /, %, ++, --, etc.
The question mark operator, ?:, is also found in C++. Some people
call it the ternary operator because it is the only operator in
C++ (and Java) that takes three operands. If you are not familiar
with it, it's works like an if-else, but combines operators.
If used simply, it is elegant, but it can easily become unreadable
if nesting is used.
For example, suppose you are given some int and wish to assign
it to a variable as long as it is not negative, but if it is
negative, you wish to assign zero. Using an if-else, you write the code:
int number;
// user inputs a value and it is put into number
int answer;
if (number >= 0) {
answer = number;
}
else
answer = 0;
}
Using the ?: operator, you can combine these operators:
int number;
// user inputs a value and it is put into number
int answer = (number >= 0 ? number : 0);
The code inside the parens evaluates to either number or 0 as the
? acts like an if, and then that value is assigned to answer.
C++ also includes operators to act on bits, e.g., and (&), or (|),
xor (^), not (~), left shift (
>). These will
not be covered.
Control structures
Not much to say here. Java's control structures were based on
the control structures in C++. The if, for, while, do-while,
and switch are identical. There are also the break and continue statements. |
| Markdown | **C/C++ data types, basic operators, and control structures**
**Data types**
Data types in C++ are similar to Java. There are ints, floats, doubles, etc. In C++ it's bool instead of boolean. There are long and short ints although you are not assured of the number of bytes for each. There are also signed and unsigned ints. Unsigned ints can only hold ints \>= zero.
Some operations are not completely defined, e.g., division involving negative numbers, so it is possible to get different answers using different compilers. You shouldn't have problems though with the computations in your courses.
Characters are similar with literals in single quotes. The char type in C++ does not have a specified byte size although they are typically stored in 8 bits.
String terminology can be ambiguous. There is a *string* class with all the usual functionality, but C/C++ programmers also refer to char arrays as strings. If you have an array of char, always store the NULL character, '\\0' as the final character of the string. If you do this, then you can traverse and compare char by char, but you can also use the whole thing as you would a string object for I/O, e.g., if \  s \  is a valid char array, cout
Note that when initializing on the declaration, the '\\0' char will automatically be stored. So the following char array will have six elements: `` **Basic operators**
The basic operators are the same as in Java, e.g., +, -, \*, /, %, ++, --, etc.
The question mark operator, ?:, is also found in C++. Some people call it the ternary operator because it is the only operator in C++ (and Java) that takes three operands. If you are not familiar with it, it's works like an if-else, but combines operators. If used simply, it is elegant, but it can easily become unreadable if nesting is used.
For example, suppose you are given some int and wish to assign it to a variable as long as it is not negative, but if it is negative, you wish to assign zero. Using an if-else, you write the code: `` Using the ?: operator, you can combine these operators: `` The code inside the parens evaluates to either number or 0 as the ? acts like an if, and then that value is assigned to answer.
C++ also includes operators to act on bits, e.g., and (&), or (\|), xor (^), not (~), left shift (
\>). These will not be covered.
**Control structures**
Not much to say here. Java's control structures were based on the control structures in C++. The if, for, while, do-while, and switch are identical. There are also the break and continue statements. `` |
| Readable Markdown | **Data types**
Data types in C++ are similar to Java. There are ints, floats, doubles, etc. In C++ it's bool instead of boolean. There are long and short ints although you are not assured of the number of bytes for each. There are also signed and unsigned ints. Unsigned ints can only hold ints \>= zero.
Some operations are not completely defined, e.g., division involving negative numbers, so it is possible to get different answers using different compilers. You shouldn't have problems though with the computations in your courses.
Characters are similar with literals in single quotes. The char type in C++ does not have a specified byte size although they are typically stored in 8 bits.
String terminology can be ambiguous. There is a *string* class with all the usual functionality, but C/C++ programmers also refer to char arrays as strings. If you have an array of char, always store the NULL character, '\\0' as the final character of the string. If you do this, then you can traverse and compare char by char, but you can also use the whole thing as you would a string object for I/O, e.g., if \  s \  is a valid char array, cout
Note that when initializing on the declaration, the '\\0' char will automatically be stored. So the following char array will have six elements: `` **Basic operators**
The basic operators are the same as in Java, e.g., +, -, \*, /, %, ++, --, etc.
The question mark operator, ?:, is also found in C++. Some people call it the ternary operator because it is the only operator in C++ (and Java) that takes three operands. If you are not familiar with it, it's works like an if-else, but combines operators. If used simply, it is elegant, but it can easily become unreadable if nesting is used.
For example, suppose you are given some int and wish to assign it to a variable as long as it is not negative, but if it is negative, you wish to assign zero. Using an if-else, you write the code: `` Using the ?: operator, you can combine these operators: `` The code inside the parens evaluates to either number or 0 as the ? acts like an if, and then that value is assigned to answer.
C++ also includes operators to act on bits, e.g., and (&), or (\|), xor (^), not (~), left shift (
\>). These will not be covered.
**Control structures**
Not much to say here. Java's control structures were based on the control structures in C++. The if, for, while, do-while, and switch are identical. There are also the break and continue statements. `` |
| Shard | 111 (laksa) |
| Root Hash | 13741598130800272711 |
| Unparsed URL | edu,washington!courses,/css342/zander/css332/datatypes.html s443 |