In this section:
This error is generated whenever an uninitialized pointer is passed as an argument to a function which expects an array parameter.
|
The following code passes the uninitialized pointer a
to routine foo
.
/* * File: parmuptr.c */ char foo(a) char a[10]; { return a[0]; } main() { char *a; foo(a); return (0); } |
[parmuptr.c:5] **PARM_UNINIT_PTR** >> { Array parameter is uninitialized pointer: a Stack trace where the error occurred: foo() parmuptr.c, 5 main() parmuptr.c, 14 |
This problem is usually caused by omitting an assignment or allocation statement that would initialize a pointer. The code given, for example, could be corrected by including an assignment as shown below.
/* * File: parmuptr.c (Modified) */ ... main() { char *a, b[10]; a = b; foo(a); } |