Warning - Dereferencing uninitialized pointer
Employee
Aug 04, 2009
08:01 AM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Aug 04, 2009
08:01 AM
Answer:
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
Labels
Rate this article: