summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-01-26 14:29:09 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-01-26 14:29:09 +1300
commit7df4e8635e21adb9e3e08444e07d776dc958c33d (patch)
tree6ca968bf26d49be555a054eb37765ec4c76c2e75
parentRe-use passed pointers for cheap iteration (diff)
downloadfuncptr-7df4e8635e21adb9e3e08444e07d776dc958c33d.tar.gz
funcptr-7df4e8635e21adb9e3e08444e07d776dc958c33d.zip
Add length to arrays
To satisfy -Wall, -Wpedantic
-rw-r--r--funcptr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/funcptr.c b/funcptr.c
index 33d4154..dc4aaf3 100644
--- a/funcptr.c
+++ b/funcptr.c
@@ -4,7 +4,7 @@
int doub(int);
int trip(int);
int half(int);
-static int (*fpv[])(int);
+static int (*fpv[4])(int);
void fpv_exec(int (**)(int), int);
int doub(int i) {
@@ -19,7 +19,7 @@ int half(int i) {
return i / 2;
}
-static int (*fpv[])(int) = {doub, trip, half, NULL};
+static int (*fpv[4])(int) = {doub, trip, half, NULL};
void fpv_exec(int (**fpv)(int), int n) {
while (*fpv)