Hello, I'm writing a program that will be utilizing triple pointers but for some reason my test program isn't working as it should:
The result should be:Code:#include <stdio.h> #include <stdlib.h> int main() { char *tmp; char *ptr; char **ptr2; char ***ptr3; ptr = malloc(2); *ptr = 5; tmp = ptr + 1; *tmp = 6; *ptr2 = ptr; **ptr3 = ptr2; printf("%d\n", ***ptr3); printf("%d\n", ***(ptr3 + 1); return 0; }
5
6
Instead I get a segmentation fault.