Guajara in other languages: Spanish, Deutsch, French, Italian ...



Wild pointer

Wild pointers are pointers that have not been initialized (set to point to a valid address) and can make a program crash and/or behave weird. This is due to the fact that in the programming language C pointers that were not specifically initialized point to random addresses in memory.

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




Wikipedia - All text is available under the terms of the GNU Free Documentation License.

Tagoror dot com  -  Legal Information  -  Contact us