Allocate space in memory using malloc(), and then character pointer is assigned a value, beyond the space allocated.This can cause indeterminate program behavior (usually leading to a segfault), or hijack the program's flow.
char *ptr = (char*) malloc(10); //initialise a buffer of size 10
ptr[10]='c';
The pointer is not allowed to access heap memory that does not belong to it.
|