Hi
I came across this question in C++ Primer by Stanley Lippman.

[CODE]
int
main()
{
const char ca[] = {'h', 'e', 'l', 'l', 'o'};
const char cp = ca;
while(
cp )
{
cout << *cp << endl;
++cp;
}
}
[/CODE]

According to me, this code should produce indefinite result because of no specified null character at the end of the string, as the loop would continue until it finds a null character in any memory location.
But when I compiled the code, it runs for EXACLTY 13 times each times. WHy does the loop terminate after 13 iterations? OR Why is the null character present in the 13th memory location EACH TIME?
OR Im just wrong with my concepts, which I think I am.
Do help me.

me ->> really?
LOL

494

498
zzzz

Homer --> Epiphany

502

Sure he was

No it wasn't.

Bump my sweet 18

Bored To Death

nerds, who don't get laid...(JK)

jingda commented: 1 word only +0

D'OH !

^ Is Indian...(me too...YAY)
< Is Schizophrenic
V Is a Time Killer..

im schizophrenic......

can i lick my ass?

pallazo --> D'OH ! (what the hell does pallazo mean?)

(sir) drink a lot

headshot

506

@kraai....t houught u were done with this

[QUOTE=Adak;1450601]What have you tried?

With linked lists, it's best to study it, and have a good sample program that you know works, to refer to while you are troubleshooting your own program.

I would either refer to your class/book notes on it for this, or grab a none good program from the net, and have it close at hand. Study it, to confirm that your idea of how it should work, corresponds correctly with the known good program.

Linked lists are a bit of a pain to just create out of thin air, if you're new to them, and have nothing to study in the way of good working code, first.[/QUOTE]

i think he heard the first time

oh come on, it cant get any simpler than [URL="

892
Oh come on guys

846

844

8 4 2 zzzzzz

846

nothing weird in my compiler; just got a simple textbox saying hello world. used visual c++ 2010.

802

venom of cobra

2726 lines just for tic tac toe ?! man you gotta be kidding me. i have one in c++, less than 150. get real dude.

the file here would be .txt, but the content would be binary. you can for sure open the file, but you cannot read it, unless you can understand binary.
if you want the contents in simple english, you cannot use read() and write() functions as these work only with binary file.
lookup file handling [URL="