Pointers to Pointers and Multilevel Indirection in C
Pointers to pointers allow you to create multilevel indirection and handle complex data structures that involve multiple levels of memory references.
#include <stdio.h>
int main() {
int num = 42;
int* ptr = #
int** ptrToPtr = &ptr;
int*** ptrToPtrToPtr = &ptrToPtr;
printf("Value: %d\n", ***ptrToPtrToPtr);
printf("Address: %p\n", ***ptrToPtrToPtr);
return 0;
}
No comments:
Post a Comment