aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-11-14 18:49:04 +0100
committerlemon <lsof@mailbox.org>2025-11-14 19:04:51 +0100
commita287fe5aeb6b681ab405c0297841dce64ab4b946 (patch)
tree5ae81f3b60cc910cd356059a77e89dd50ca83b42 /test
parentfc91a4ce139fd0236ad9e8c4fe1e7dad42f0b178 (diff)
preeliminary va_list support
Diffstat (limited to 'test')
-rw-r--r--test/varargs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/varargs.c b/test/varargs.c
new file mode 100644
index 0000000..ff7d41d
--- /dev/null
+++ b/test/varargs.c
@@ -0,0 +1,17 @@
+#include <stdarg.h>
+#include <stdio.h>
+
+int sum(int x, ...) {
+ va_list ap;
+ va_start(ap, x);
+ for (int y; (y = va_arg(ap, int));) {
+ printf("got %d\n",y);
+ x += y;
+ }
+ va_end(ap);
+ return x;
+}
+
+int main() {
+ printf("%d\n", sum(1,2,3,4,5,6,7,0,0));
+}