In this section:
Overview
This error is generated whenever an expression operates on an uninitialized pointer. Expression uses uninitialized pointerCode Description Enabled Reported Platform EXPR_UNINIT_PTR Runtime Windows/Unix
Problem
In the following code uses an uninitialized pointer.
/* * File: expuptr.c */ main() { char *a, b[10], c[10]; if (a > b) a = b; return (0); }
Diagnosis at Runtime
[expuptr.c:8] **EXPR_UNINIT_PTR** >> if (a > b) Expression uses uninitialized pointer: a > b Stack trace where the error occurred: main() expuptr.c, 8
- Line 1: Source line at which the problem was detected.
- Line 3: Description of the problem and the expression that is in error.
- Line 4: Stack trace showing the function call sequence leading to the error.
Repair
This error is normally caused by omitting an assignment statement for the uninitialized variable. The example code can be corrected as follows:
/* * File: expuptr.c (modified) */ main() { char *a, b[10], c[10]; a = c; if (a > b) a = b; return (0); }