Please, I'm sorry for such a noob question. I'm learning. The book is introducing me to char arrays without passing them as arguments...
Then, I tried ...by myself ... Would be pretty nice if someone just ..explain me, "why should I mess with pointers", here...
And the compiler message:Code:#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int stringCount(char); int main(int nNumberofArgs, char *pszArgs[]) { char szInput[1024] = {0}; cout << "Enter a word and press RETURN:\n"; cin >> szInput; cout << stringCount(szInput); // for (int nCounter = stringCount(szInput); nCounter >= 0; nCounter--) cout << szInput[nCounter]; cout << endl; system("pause"); return 0; } int stringCount(char szValue[]) { for (int nCounter = 0; szValue[nCounter]; nCounter++) return nCounter; }
In function `int main(int, char**)':
13 invalid conversion from `char*' to `char'
13 initializing argument 1 of `int stringCount(char)'
Don't blame me... I know about some of the useless stuff (main() arguments, maybe some libs that I included, or the namespace line... I'm learning about that)
And sorry for my bad english... I'm a foreign speaker
Thank you very much,
Arthur