From 94b65987d4e4d51efc22f6e06d49689d0e724603 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 30 May 2018 20:48:28 -0400 Subject: [PATCH] add test 4 --- tests/t004.cxl | 21 +++++++++++++++++++++ tests/t004.x | 1 + 2 files changed, 22 insertions(+) create mode 100644 tests/t004.cxl create mode 100644 tests/t004.x diff --git a/tests/t004.cxl b/tests/t004.cxl new file mode 100644 index 0000000..5f2a6f2 --- /dev/null +++ b/tests/t004.cxl @@ -0,0 +1,21 @@ +/* + * Test C99 declaration in for() loop. + */ +#include + +int v[10] = {1, 2, 3, 4, 1, 2, 3, 4, 5, 6}; + +int sum() +{ + int s = 0; + for(int i = 0; i < 10; i++) + { + s += v[i]; + } + return s; +} + +int main(int argc, char * argv[]) +{ + printf("%d\n", sum()); +} diff --git a/tests/t004.x b/tests/t004.x new file mode 100644 index 0000000..e85087a --- /dev/null +++ b/tests/t004.x @@ -0,0 +1 @@ +31