This is not only true of perl and Java. In my C++ class I learned many, easily 20+ lines of code, difficult ways to create unlimited arrays. Once I looked at the standard headers included with C++, this was 4 years ago, I noticed vector.
#include <vector> #include <iostream> std::vector<char> array; char c = 0; while(c != 'X' || c != 'x') { //enter something or exit to quit std::cin>>c; array.push_back(c); //remind you of anything ;) } std::cout<<array.size()<<std::endl; /* btw., the way I learned to get an arrays length was to create a sec +ond int array as a counter*/
As for why the One Way, or more approapriately Best Way is ignored, that's a good question
"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce
In reply to Re: There's Only One Way To Do It
by kutsu
in thread There's Only One Way To Do It
by jdporter
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |