Could someone give me a little nugget of code to count how many charactors there are in a string?
Here's a function I was trying to get to count how many chars were in a string:
My compiler, Dev-C++ 5 beta, gives the error: subscripted value is neither array nor pointer (and it doesn't compile). I put the line it reported this on in bold.Code:int current_char; static char somestring[5] = { "Hello" }; int getstrlength(somestring) { for (current_char = 0;current_char < 80;current_char++) { if (somestring[current_char] == '\0') { return (current_char); break; } } }
On a sidenote the ASCII tables on www.asciitable.com are not really correct, at least for my PC... some of the box drawing chars at the bottom are really accented A charactors, which turned out to be quite annoying for what I was doing. I'm looking for box drawing chars which join double lines to single lines on corners or T shapes etc.
Thanks for any help!