Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Use of Const keyword in ANSI C
Message-ID: <1988Sep9.160616.11061@utzoo.uucp>
Organization: U of Toronto Zoology
References: <441@optilink.UUCP>
Date: Fri, 9 Sep 88 16:06:16 GMT

In article <441@optilink.UUCP> cramer@optilink.UUCP (Clayton Cramer) writes:
>        const char*     C;
>    Test1.C = "not a test case";    /* compiler accepts this -- bad */
>
>Should the attempt to set Test1.C to point to another string cause a
>complaint from the compiler?

No.  You have misunderstood the (messy) syntax of const.  "const char *"
is a pointer to const char, not a const pointer to char.  To get a const
pointer to char, say "char *const C;" instead.  Yes, this is ugly.
-- 
Intel CPUs are not defective,  |     Henry Spencer at U of Toronto Zoology
they just act that way.        | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
