diff options
-rw-r--r-- | tests/hello_world_loop.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/hello_world_loop.cpp b/tests/hello_world_loop.cpp new file mode 100644 index 00000000..02241ff1 --- /dev/null +++ b/tests/hello_world_loop.cpp @@ -0,0 +1,15 @@ +#include<stdio.h> +#include<string.h> +#include<stdlib.h> + +int main() { + char *original = (char*)"h e l l o , w o r l d ! "; + char *copy = (char*)malloc(strlen(original)); + for (int i = 0; i < strlen(original); i += 2) { + copy[i/2] = original[i]; + } + copy[strlen(copy)+1] = (int)&original; // force original to be on the stack + puts(copy); + return 1; +} + |