Sha256: 740b5e85f6b363c083cc216aedc296d2909d3882ab85bd2360d8efe1093575e5

Contents?: true

Size: 771 Bytes

Versions: 133

Compression:

Stored size: 771 Bytes

Contents

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

#include "series.h"

series_results_t series(char *input_text, unsigned int substring_length)
{
   int substring_count = strlen(input_text) - (substring_length - 1);
   series_results_t results;

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

Version data entries

133 entries across 133 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/c/exercises/series/src/example.c
trackler-2.2.1.97 tracks/c/exercises/series/src/example.c
trackler-2.2.1.96 tracks/c/exercises/series/src/example.c
trackler-2.2.1.95 tracks/c/exercises/series/src/example.c
trackler-2.2.1.94 tracks/c/exercises/series/src/example.c
trackler-2.2.1.93 tracks/c/exercises/series/src/example.c
trackler-2.2.1.92 tracks/c/exercises/series/src/example.c
trackler-2.2.1.91 tracks/c/exercises/series/src/example.c
trackler-2.2.1.90 tracks/c/exercises/series/src/example.c
trackler-2.2.1.89 tracks/c/exercises/series/src/example.c
trackler-2.2.1.88 tracks/c/exercises/series/src/example.c
trackler-2.2.1.87 tracks/c/exercises/series/src/example.c
trackler-2.2.1.86 tracks/c/exercises/series/src/example.c
trackler-2.2.1.85 tracks/c/exercises/series/src/example.c
trackler-2.2.1.84 tracks/c/exercises/series/src/example.c
trackler-2.2.1.83 tracks/c/exercises/series/src/example.c
trackler-2.2.1.82 tracks/c/exercises/series/src/example.c
trackler-2.2.1.81 tracks/c/exercises/series/src/example.c
trackler-2.2.1.80 tracks/c/exercises/series/src/example.c
trackler-2.2.1.79 tracks/c/exercises/series/src/example.c