This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Function "strlen()" work like "sizeof()" within Evaluation Kit

While I am working with the Evaluation Kit (contains an old Version of C51), I used
"strlen()" within a function, where the string in referenced using a pointer. The result is always 2 or 3; which is the size of the pointer variable. Now I guess,
"strlen()" simple consist of a "sizeof()" sourcecode.

Example:

// String + size
char stringbuffer[] = "Hello\0";
int string_length1;

// Correct Value
string_length1 = strlen( stringbuffer );

// Function Call
wrong_function( stringbuffer );

// Function
wrong_function( char* stringpointer )
{
int length_string2;

// wrong value
length_string2 = strlen( stringpointer );
}