|
|
The following example code shows a wild pointer:
\r\n#include\r\n#include \r\n\r\nint main(void)\r\n{\r\n char * p1 = (char*)malloc(sizeof(char*)); // initialized pointer\r\n printf("Address of p1: 0x%x\\n", p1);\r\n\r\n char * p2; // wild pointer\r\n printf("Address of p2: 0x%x\\n", p2);\r\n\r\n //the programming probably already crashed before it reaches return\r\n\r\n return 0;\r\n}\r\n