Where is the implementation of strlen() in GCC?

后端 未结 10 1076
梦毁少年i
梦毁少年i 2021-02-04 01:21

Can anyone point me to the definition of strlen() in GCC? I\'ve been grepping release 4.4.2 for about a half hour now (while Googling like crazy) and I can\'t seem

10条回答
  •  逝去的感伤
    2021-02-04 01:56

    You can use this code, the simpler the better !

    size_t Strlen ( const char * _str )
    {
        size_t i = 0;
        while(_str[i++]);
        return i;
    }
    

提交回复
热议问题