Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: Array of po...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 13 Topic 43697 of 48417
Post > Topic >>

Re: Array of pointers + memory Location

by Slain <Slain.k@[EMAIL PROTECTED] > Mar 5, 2008 at 07:07 AM

On Mar 5, 9:57 am, "Victor Bazarov" <v.Abaza...@[EMAIL PROTECTED]
> wrote:
> Nick Keighley wrote:
> > On 5 Mar, 14:38, Slain <Slai...@[EMAIL PROTECTED]
> wrote:
>
> >> I have more of a conceptual question now. Let us say I do this:-
>
> >> char *str[10]; --> create an array of pointers
> >> str[1]= "John";
>
> >> I thought this would automatically put John at some memory space and
> >> point str[1] to it.
>
> > yes
>
> Except that it shouldn't compile since "John" is an array of const
> char and 'str[1]' is a pointer to non-const char.  There is no
> conversion without a cast.  The intent probably was to declare 'str'
> as 'char const* str[10];'
>
> > [..]
>
> V
> --
> Please remove capital 'A's when replying by e-mail
> I do not respond to top-posted replies, please don't ask

It does compile as long as it is inside main or any function. So may
be it does a type conversion.
 




 13 Posts in Topic:
Array of pointers + memory Location
Slain <Slain.k@[EMAIL   2008-03-05 06:38:40 
Re: Array of pointers + memory Location
Nick Keighley <nick_ke  2008-03-05 06:44:59 
Re: Array of pointers + memory Location
"Victor Bazarov"  2008-03-05 09:57:14 
Re: Array of pointers + memory Location
Jeff Schwab <jeff@[EMA  2008-03-05 09:09:35 
Re: Array of pointers + memory Location
Micah Cowan <micah@[EM  2008-03-05 09:38:04 
Re: Array of pointers + memory Location
Slain <Slain.k@[EMAIL   2008-03-05 07:07:43 
Re: Array of pointers + memory Location
Slain <Slain.k@[EMAIL   2008-03-05 07:07:56 
Re: Array of pointers + memory Location
James Kanze <james.kan  2008-03-06 01:24:43 
Re: Array of pointers + memory Location
utab <umut.tabak@[EMAI  2008-03-06 04:07:36 
Re: Array of pointers + memory Location
Pete Becker <pete@[EMA  2008-03-06 07:59:28 
Re: Array of pointers + memory Location
utab <umut.tabak@[EMAI  2008-03-06 04:13:10 
Re: Array of pointers + memory Location
utab <umut.tabak@[EMAI  2008-03-06 05:38:46 
Re: Array of pointers + memory Location
Triple-DES <DenPlettfr  2008-03-06 07:09:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 10:16:37 CST 2008.