summaryrefslogtreecommitdiff
path: root/funcptr.c
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-01-26 14:14:39 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-01-26 14:14:39 +1300
commit22d54ecf48ac7a42351d6edbb60dcbd151078772 (patch)
treeaf10b2ef06c577935f33dd66f5b6f85f7617c4c0 /funcptr.c
parentMove fpv to be static file var (diff)
downloadfuncptr-22d54ecf48ac7a42351d6edbb60dcbd151078772.tar.gz
funcptr-22d54ecf48ac7a42351d6edbb60dcbd151078772.zip
Count through argv so we don't edit it in place
Diffstat (limited to 'funcptr.c')
-rw-r--r--funcptr.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/funcptr.c b/funcptr.c
index 39cb843..19f2eb6 100644
--- a/funcptr.c
+++ b/funcptr.c
@@ -28,8 +28,9 @@ void fpv_exec(int (**fpv)(int), int n) {
}
int main(int argc, char **argv) {
- for (argv++, argc--; argc; argv++, argc--) {
- fpv_exec(fpv, atoi(*argv));
+ int i;
+ for (i = 1; i < argc; i++) {
+ fpv_exec(fpv, atoi(argv[i]));
}
exit(EXIT_SUCCESS);