summaryrefslogtreecommitdiff
path: root/funcptrptr.c
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-12-10 16:15:26 +1300
committerTom Ryder <tom@sanctum.geek.nz>2019-12-10 16:15:26 +1300
commit61674507111c4b73224f19730c06cc02dd3ff21f (patch)
treeab5abcd79754ec22f68620e69c5bcf5f5efd7372 /funcptrptr.c
parentAdjust implementation (diff)
downloadfuncptr-master.tar.gz
funcptr-master.zip
Add sentinel value correctly (!)HEADmaster
Diffstat (limited to 'funcptrptr.c')
-rw-r--r--funcptrptr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/funcptrptr.c b/funcptrptr.c
index 3d2fe69..b860628 100644
--- a/funcptrptr.c
+++ b/funcptrptr.c
@@ -45,14 +45,16 @@ int main(int argc, char **argv) {
int i, j, im, jm;
im = jm = 2;
- fpvvv = calloc(im, sizeof *fpvvv);
+ fpvvv = calloc(im + 1, sizeof *fpvvv);
for (i = 0; i < im; i++) {
- fpvvv[i] = calloc(jm, sizeof **fpvvv);
+ fpvvv[i] = calloc(jm + 1, sizeof **fpvvv);
for (j = 0; j < jm; j++) {
fpvvv[i][j] = malloc(sizeof fpv);
memcpy(fpvvv[i][j], fpv, sizeof fpv);
}
+ fpvvv[i][jm + 1] = NULL;
}
+ fpvvv[im + 1] = NULL;
for (argv++, argc--; argc; argv++, argc--)
fpvvv_exec(fpvvv, atoi(*argv));