Cheat-sheet for strings

This commit is contained in:
Audun Wilhelmsen 2013-12-26 13:51:01 -08:00
parent c7d99743bd
commit af175ddda1
1 changed files with 23 additions and 0 deletions

View File

@ -100,6 +100,29 @@ let z = 2
<tr>
<td>
```C
char* s = "Hello World.";
char s0 = s[0]; // 'H'
char *t = s; // Pointer to s
s[11] = '!';
// s and t are both "Hello World."
```
</td>
<td>
```Nimrod
var s: string = "Hello World."
var s0: char = s[0] # 'H'
var t = s # Copy of s
s[11] = '!'
# s is "Hello World!", t is "Hello World."
```
</td>
<td><b>Strings and char</b>. Strings are pass-by-value (copied on assignment) and strictly bounds-checked on access.</i>
</td>
</tr>
<tr>
<td>
```C
9 % 8 // 1
-9 % 8 // -1
(unsigned)(-9) % (unsigned)(8) // 7