You are here

Warning - Dereferencing uninitialized pointer | Cypress Semiconductor

Support & Community

Warning - Dereferencing uninitialized pointer

Last Updated: August 12, 2010

Question:How to overcome the warning "Dereferencing uninitialized pointer" in Hi-Tech compiler?

Response:In Hi-Tech compiler if any pointer variable is modified during code execution, the compiler will give a warning "Dereferencing uninitialized pointer" if the pointer variable is not initialised with some address.To overcome this warning , initialize the pointer variable with any address during the pointer declaration.  For example, if p is a character pointer and x is a character variable then the pointer initialization during pointer variable declaration can be made as below.

char x;          // A char variable
char *p= &x;  // Initialize the pointer while declaring it

Provide feedback on this article

Browse KB By Product

Browse KB by Type