diff options
Diffstat (limited to 'nl')
-rw-r--r-- | nl/string_index.nl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/nl/string_index.nl b/nl/string_index.nl index 27df14b..deb4188 100644 --- a/nl/string_index.nl +++ b/nl/string_index.nl @@ -1,10 +1,13 @@ extern func void(i32) putchar; +extern func u64(ptr(i8)) strlen; i32 main() { ptr(i8) s = "kaas"; + ptr(i8) orig = s; + s = s + strlen(s) - 1; i32 i = 0; - while (*(s+i) != '\x00') { - putchar(*(s + i)); + while (i < strlen(orig)) { + putchar(*(s - i)); i = i + 1; } putchar('\n'); |