Can anyone see why this code produces letters and numbers and not the numbers 0 - 14? I think the author made a typo somwhere. It is suposed to be a shorter version that having to use a for loop to literate through the array elements. I get no errors or warnings.
Code:#include <iostream> using std::cout; using std::endl; // main function - where program execution begins int _tmain(int argc, _TCHAR* argv[]) { const int ArraySize = 15; int n[ ArraySize ] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; cout << "My array: " << n << " "; getchar(); // need to freeze output in debug mode return 0; // indicates program ended sucsessfully }



LinkBack URL
About LinkBacks



That alone tells me the book isn't worth the paper its printed on.