I think the answer is pretty straightforward, as what compiler said, subscript require array or pointer. when you use str[length] that means you use subscript, that is only used for array or pointer.(Or write you own operator[], sorry i know it must be a better way to explain this)
i suggest you to grab a book about C/C++ programming, read it through, and it should be much help. It is also lots of C/C++ programming tutorial available on the internet, try to find them use Google or Ask or whatever search engine. here i found some:
C++ Language Tutorial
C programming.com - Your Resource for C and C++ Programming
good luck
Bite
|