Menu
CoddyTech

字符串长度

Coddy 入门挑战:练习基础概念 课程的第 14 课,共 20 课。

challenge icon

挑战

简单

编写一个名为 lens 的函数,它接收一个字符串数组,并返回一个整数数组,其中每个元素都是输入数组中对应索引处字符串的长度。

示例:

  • lens(['How', 'is', 'it', 'you'])  ->  [3, 2, 2, 3]
  • lens(['first', 'second', 'third', '4'])  ->  [5, 6, 5, 1]

亲手试试

#include <stdlib.h>
#include <string.h>

int* lens(char** arr, int arrSize, int* returnSize) {
    // 在这里编写代码
}

入门挑战:练习基础概念中的所有课

自己练习: C 在线编译器