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 );
}

Parents
  • Why did you feel a need to wake up an 8 year old thread that was forgotten within just a few days when it moved off from the first page of threads? You think anyone was sitting there waiting for the answer?

    Oops - maybe you thought that the forum readers really didn't had the knowledge to be able to answer the question? Didn't you even consider the possibility that the poster may have started multiple threads, and received an answer in another thread? It is a common fact, if you look around on the net, that people now and then asks questions without getting any answer. Even if there are lots of people who do know the answer.

Reply
  • Why did you feel a need to wake up an 8 year old thread that was forgotten within just a few days when it moved off from the first page of threads? You think anyone was sitting there waiting for the answer?

    Oops - maybe you thought that the forum readers really didn't had the knowledge to be able to answer the question? Didn't you even consider the possibility that the poster may have started multiple threads, and received an answer in another thread? It is a common fact, if you look around on the net, that people now and then asks questions without getting any answer. Even if there are lots of people who do know the answer.

Children