add a simple argv/argc test

master
neingeist 11 years ago
parent c6c8d4eb53
commit 3771b2578e

@ -11,7 +11,7 @@ TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs \
uiowa-threads-example uiowa-threads-my-example \ uiowa-threads-example uiowa-threads-my-example \
mtrace-test av-variance undefined-behaviour \ mtrace-test av-variance undefined-behaviour \
multibrot-openmp hello-openmp mandelbrot-openmp \ multibrot-openmp hello-openmp mandelbrot-openmp \
positional-format-strings unions positional-format-strings unions argv
EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s \ EXTRAS=mandelbrot.bmp multibrot.png test-inline-assembly.s \
mtrace-test.trace mtrace-test.txt multibrot-openmp.png mtrace-test.trace mtrace-test.txt multibrot-openmp.png
VERYEXTRAS=cppcheck.txt macros.txt tags VERYEXTRAS=cppcheck.txt macros.txt tags

@ -0,0 +1,10 @@
#include <stdio.h>
int main(int argc, char* argv[]) {
for (int i = 0; i<argc; i++) {
printf("%d: %s\n", i, argv[i]);
}
if (argv[argc] == 0) {
printf("\nargv[argc] is a null pointer, as required by the standard!\n");
}
}
Loading…
Cancel
Save