遞歸和非遞歸分別實現strlen

遞歸和非遞歸分別實現strlen 1.非遞歸: int my_strlen(char *str)//d定義函數 { int count = 0;//計數 while (*str !=’\0’)//判斷,當字符不爲’\0’;時 { count++;//計數加一 str++;//字符往前加一 } return count; } int main() { char arr[] = 「hello」; in
相關文章
相關標籤/搜索