Sha256: c87ecd5fb8e7f35bb54f732ca47492a3e3af66ffd3c39362e140012b5b5fdbc4

Contents?: true

Size: 755 Bytes

Versions: 240

Compression:

Stored size: 755 Bytes

Contents

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

#include "series.h"

SeriesResults_t series(char *inputText, unsigned int substringLength)
{
   int substringCount = strlen(inputText) - (substringLength - 1);
   SeriesResults_t results;

   memset(&results, 0, sizeof(results));
   if ((substringCount > 0) && (substringLength > 0)) {
      results.substringCount = substringCount;
      results.substring = malloc(sizeof(char *) * substringCount);
      for (int index = 0; index < substringCount; index++) {
         results.substring[index] =
             malloc(sizeof(char) * (substringLength + 1));
         sprintf(results.substring[index], "%.*s", substringLength,
                 &inputText[index]);
      }
   }
   return results;
}

Version data entries

240 entries across 240 versions & 1 rubygems

Version Path
trackler-2.2.1.45 tracks/c/exercises/series/src/example.c
trackler-2.2.1.44 tracks/c/exercises/series/src/example.c
trackler-2.2.1.43 tracks/c/exercises/series/src/example.c
trackler-2.2.1.42 tracks/c/exercises/series/src/example.c
trackler-2.2.1.41 tracks/c/exercises/series/src/example.c
trackler-2.2.1.40 tracks/c/exercises/series/src/example.c
trackler-2.2.1.39 tracks/c/exercises/series/src/example.c
trackler-2.2.1.38 tracks/c/exercises/series/src/example.c
trackler-2.2.1.37 tracks/c/exercises/series/src/example.c
trackler-2.2.1.36 tracks/c/exercises/series/src/example.c
trackler-2.2.1.35 tracks/c/exercises/series/src/example.c
trackler-2.2.1.34 tracks/c/exercises/series/src/example.c
trackler-2.2.1.33 tracks/c/exercises/series/src/example.c
trackler-2.2.1.32 tracks/c/exercises/series/src/example.c
trackler-2.2.1.31 tracks/c/exercises/series/src/example.c
trackler-2.2.1.30 tracks/c/exercises/series/src/example.c
trackler-2.2.1.29 tracks/c/exercises/series/src/example.c
trackler-2.2.1.28 tracks/c/exercises/series/src/example.c
trackler-2.2.1.27 tracks/c/exercises/series/src/example.c
trackler-2.2.1.26 tracks/c/exercises/series/src/example.c