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 …

Member Avatar
Member Avatar
+0 forum 2

hello people...Im new in Daniweb. pursuing bachelors in IT and looking forward to learn a lot from these forums. Gotta be the best to beat the rest.

Member Avatar
Member Avatar
+0 forum 2

When we define an array, we have to declare its size before the program can be compiled. How can we specify it's size, say, by inputting a value from the user. I know a way with pointers; any other way?

Member Avatar
Member Avatar
+0 forum 1

Hey.. Can anyone suggest me must do projects in c++ so that i can become used to it a develop a little confidence. Small games, apps would be appreciated.

Member Avatar
Member Avatar
+0 forum 1

The End.