What about
char *s6="wombat";
?
This makes s6 a pointer to the characters {'w','o','m','b','a','t','\0'}. There
is not really any difference between char s6[] and char *s6. You can still do
s6[0] which is the same as *s6. And s6[1] which is *(s6+1). s6[n] is just an
alternate way to say *(s6+n). Which is identical to *(n+s6). Which is identical
to n[s6]. As weird as that may be. I am not sure what C++ would do with that.
--
John McKown
Systems Engineer IV
IT
Administrative Services Group
HealthMarkets®
9151 Boulevard 26 • N. Richland Hills • TX 76010
(817) 255-3225 phone •
[email protected] • www.HealthMarkets.com
Confidentiality Notice: This e-mail message may contain confidential or
proprietary information. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original message.
HealthMarkets® is the brand name for products underwritten and issued by the
insurance subsidiaries of HealthMarkets, Inc. –The Chesapeake Life Insurance
Company®, Mid-West National Life Insurance Company of TennesseeSM and The MEGA
Life and Health Insurance Company.SM
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:[email protected]]
> On Behalf Of Paul Gilmartin
> Sent: Tuesday, September 04, 2012 6:51 PM
> To: [email protected]
> Subject: Re: The IBM zEnterprise EC12 announcment
>
> On Tue, 4 Sep 2012 15:01:37 -0400, Thomas David Rivers wrote:
> >
> > cxx: t.c line 3:Error #144: a value of type "const char [7]" cannot
> >be used to initialize an entity of type "char [6]"
> > char s6[ 6 ] = "wombat";
> >
> Is there any convenient way to perform this initialization? (I don't
> consider either overallocating the array or enumerating individual
> chars in a multiple initializer convenient.)
>
> Thanks,
> gil
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN