March 15th, 2003, 09:11 AM
I havent found much online how to do this..I just want the user to type out a string and using strlen, give the user how many characters he/she typed..anyone can help real quick? Regards.
March 15th, 2003, 09:13 AM
March 15th, 2003, 10:23 AM
Using strlen() is easy. Just pass it a string, and it returns the number of characters in the string (not including the NULL character at the end). Here's an example from MSDN:
/* STRLEN.C */
void main( void )
char buffer = "How long am I?";
len = strlen( buffer );
printf( "'%s' is %d characters long\n", buffer, len );
Where exactly are you having problems? With the user input, or with using strlen()? There are a number of ways to get user input into a string.
March 15th, 2003, 11:46 AM
Ahh...thx for the google link..i forgot to put the () at the end of the strlen in my search. I understand now guys, thanks!