aboutsummaryrefslogtreecommitdiff
path: root/tests/hello_world_loop.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-12 15:08:04 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-12 15:08:04 -0800
commit94476d0fcde4f3b55dd05014c7394ba2d088f076 (patch)
tree456f50e0f9ef8a9e146aa7fdeb04823b250ef19e /tests/hello_world_loop.cpp
parentb20139fe546fda014e8da8eaf3058ff5d07e3fd2 (diff)
add missing file test_hello_world_loop.cpp
Diffstat (limited to 'tests/hello_world_loop.cpp')
-rw-r--r--tests/hello_world_loop.cpp15
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;
+}
+