Re: I need some basic C++ help
From: John Carson (donaldquixote_at_datafast.net.au)
Date: 11/20/03
- Next message: Joseph Suprenant: "printing 0x00 in ascii"
- Previous message: John Carson: "Re: I need some basic C++ help"
- In reply to: Dave: "Re: I need some basic C++ help"
- Next in thread: Andrey Tarasevich: "Re: I need some basic C++ help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 Nov 2003 14:22:37 +1100
"Dave" <better_cs_now@yahoo.com> wrote in message
news:vro7qiktrns332@news.supernews.com
> "John Carson" <donaldquixote@datafast.net.au> wrote in message
> news:3fbc1cc9@usenet.per.paradox.net.au...
> > "Dave" <better_cs_now@yahoo.com> wrote in message
> > news:vro33uncnb3kc8@news.supernews.com
> > >
> > > Oops, sorry, I should have said "array of const char" instead of
> > > "const char
> > > *". So, it's really an array, and *then* that array undergoes a
> > > conversion to a pointer when the compiler encounters "modem".
> > > Finally then, as I said before, a pointer cannot be assigned to an
> > > array...
> >
> > It is not the chars that are const --- if they were you couldn't
> > change the char values. Rather, it is the location in memory of the
> > chars that cannot be changed. In pointer terms, it is like a const
> > pointer to char, i.e., char * const
> >
> >
> > --
> > John Carson
> > 1. To reply to email address, remove donald
> > 2. Don't reply to email address (post here instead)
> >
>
> 2.13.4-1: An ordinary string literal has type "array of n const char"
>
> And indeed, you may not change the characters of a string literal.
My mistake. I misread your post as referring to the array
char name[80];
rather than to the string literal.
-- John Carson 1. To reply to email address, remove donald 2. Don't reply to email address (post here instead)
- Next message: Joseph Suprenant: "printing 0x00 in ascii"
- Previous message: John Carson: "Re: I need some basic C++ help"
- In reply to: Dave: "Re: I need some basic C++ help"
- Next in thread: Andrey Tarasevich: "Re: I need some basic C++ help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|