pointers - why dosn't this work?

Roger Knopf 5502 rogerk at sco.COM
Fri Apr 6 09:23:52 AEST 1990

In article <23467 at mimsy.umd.edu> dbk at mimsy.umd.edu (Dan Kozak) writes:
>From article <6067 at ozdaltx.UUCP>, by root at ozdaltx.UUCP (root):
>> #include <stdio.h>
>> #include <string.h>
>> main()
>> {
>>       char b[1][20];
>>       char *x="This is a test";
>>       char *a[3];
>	     ^^^^^ this is a pointer to an array of 3 chars, but the
>		   array(s) that it points to have not been allocated
>		   and it hasn't itself been initialized.

Your concept is right but it is actually an array of 3 pointers to
char. The result is still the same - these pointers are unitialized
and point to who-knows-what.

Roger Knopf
SCO Consulting Services

"His potential clients were always giving him the business."
	--Robert Thornton

More information about the Comp.lang.c mailing list