English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I know how to use this function, but now I want to know how it was written, I need the exact website or source code

2006-06-12 20:45:38 · 3 answers · asked by macausite 2 in Computers & Internet Programming & Design

3 answers

I doubt you can find the exact source code, but my guess is all it does is start a counter at 0, start going through the string and counting characters until it hits the NULL terminator.

Something like this:

int strlen(char*)
{
int count = 0;
while (*(char + count) != 0)
{
count++;
if (count == 0xffffffff) //if max int size
break;
}
return (count);

2006-06-13 01:03:21 · answer #1 · answered by justme 7 · 1 0

javascript

2006-06-13 03:51:22 · answer #2 · answered by Anonymous · 0 0

goto this link
http://www.cplusplus.com/ref/cstring/strlen.html

2006-06-13 03:48:29 · answer #3 · answered by Haynaku 2 · 0 0

fedest.com, questions and answers