I have a problem trying to call a fuction with the string and the colon (':') as arguments. It is suppose to return then count number of tokens seperated by the colon in the string. The output should be shown in main. Any help is aprreciated. Thanks.
Code:
int countToken(char theString[],':');
int main(void)
{
//local declerations
char theString[] = "abcd0001:groupno:userno:name:/bin/ksh";
int tokenCount;
//statements
tokenCount = countToken(theString,':');
cout << " Number of words in string are: " << tokenCount;
}//main
int countToken (char theString[],':')
{
int count;
while (theString)
{
if (theString[] == ':')
count++;
}//while
return count;
} //countToken