add a simple argv/argc test
This commit is contained in:
parent
c6c8d4eb53
commit
3771b2578e
2 changed files with 11 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -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
|
||||||
|
|
10
argv.c
Normal file
10
argv.c
Normal file
|
@ -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…
Add table
Add a link
Reference in a new issue