Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Warning - Dereferencing uninitialized pointer

Warning - Dereferencing uninitialized pointer

DineshbabuM_66
Employee
Employee
First like received
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

0 Likes
1297 Views
Contributors