summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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));