SUMMARY OF confusion with char *a and char a[NUM]

Doug Gwyn gwyn at smoke.brl.mil
Thu Dec 6 09:45:21 AEST 1990


In article <7676 at umd5.umd.edu> jjk at astro.umd.edu (Jim Klavetter) writes:
>I guess my followup question is more theoretical in nature:  is this a
>good thing?  Why shouldn't 
>	 strcpy(string, a); 
>also send an error message ...

This feature of C certainly can't be changed, as there are billions of lines
of existing source code written with the assumption that C works like that.

As to why Dennis made arrays second-class citizens (which is really at the
root of this kludgery), I don't know.  I would guess that since he didn't
plan to fully support them (as assignable, etc.) anyway, but still wanted
to allow the programmer to use arrays, he settled on the simplest method of
dealing with them, given that pointers are fundamental to the C language.



More information about the Comp.lang.c mailing list