Menu
Coddy logo textTech

Length of strings

Lesson 14 of 20 in Coddy's Beginner Challenges - Practice Basic Concepts course.

challenge icon

Challenge

Easy

Write a function named lens that gets an array of strings and returns an array of integers, where each element is the length of the string corresponding to the same index in the input array.

Examples,

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

Try it yourself

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

int* lens(char** arr, int arrSize, int* returnSize) {
    // Write code here
}

All lessons in Beginner Challenges - Practice Basic Concepts