Re: Simple Array question - Newbie

From: Fantius (kjhkahask_at_dsjfdjsfh.com)
Date: 08/03/04


Date: Mon, 2 Aug 2004 23:00:05 -0400

Did you expect just to see the output, "h"? The point that you might be
missing is that it is outputing all characters until it finds a chr(0), or
null character, which marks the end of the string.

<TJ> wrote in message news:k96tg09gerftjfa4541rklpvqr7iml77up@4ax.com...
> Hi,
>
> I read somewhere where it says if i declare an array this way:
>
> char greeting[]="hello";
>
> Then, referring to the array as greeting only from the code, will
> imply the address of the first element in the array.
>
> Shouldn't that produce the address of the first element if i do
> cout<<greeting;
>
> I tried that, but it produced the word hello out on the screen.
>
> I am confused on that. Will appreciate some help.
>
> Thanks,
>
> TJ



Relevant Pages

  • Re: sending echo to all clients
    ... I did initialize it up properly, ... There is only one array and that is an array of pollfd structures named ... as an array of characters only but then I can't because sendsends bytes ... you receive C-style strings, so there's really no point to doing it. ...
    (comp.unix.programmer)
  • Re: Subquery Confusion
    ... Then I got this crazy idea that an Array can only contain a maximum ... number of characters, ... Then I decide that maybe I'm completely wrong with my query, ... it out of Excel VBA and spit it into Microsoft SQL Server Management ...
    (microsoft.public.excel.programming)
  • Re: ifstream::get() surprise
    ... Extracts characters and stores them into successive locations ... > null character into the next successive location of the array. ... since the rule is to post the shortest code suffering from the ...
    (comp.lang.cpp)
  • Re: Problem with inserting bytea into postgresql
    ... > This byte array is serialized object. ... > ByteArrayOutputStream outputStream = new ByteArrayOutputStream; ... and the characters are encoded via UTF-8. ...
    (comp.lang.java.help)
  • Re: Parsing binary values in the registry
    ... how to take a string variable that could concievably be up to 300 ... and split that into either an array or multiple variables for ... every 32 characters within the original varable. ... I am trying to build a file path from a binary value in the ...
    (microsoft.public.scripting.vbscript)