Originally Posted by two31dvs.Code:char *v = "this is a C style string"; int sc = 0; while (*v++) { ++s; }Although the two are computationally equivilent, the first is far more concise. If the instructors don't want you to use shorthand, why the heck are they teaching C++ in the first place? Do they skip over the use of "cout << variable" because students might confuse it with left shift operations?Code:char *v = "this is a C style string"; int sc = 0; while (*v) { v = v + 1; s = s + 1; }
The example is trivial, but I have other things to do.