blob: 79437f0876046a4c46d05e53a8bc9b872cc80d83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
void test_chars () {
char* s = "foo";
char* begin = s;
char* end = begin + 2;
assert (begin[0] == 'f');
assert (end[0] == 'o');
}
void test_strings () {
string s = "foo";
string* begin = s;
string* end = begin + s.length - 1;
assert (((char*) begin)[0] == 'f');
assert (((char*) end)[0] == 'o');
}
void main () {
test_chars ();
test_strings ();
}
|