Sha256: b8d201e185e7858ddcc10a7737c8b976226a43e2653a7f5335a07d56de429516

Contents?: true

Size: 547 Bytes

Versions: 131

Compression:

Stored size: 547 Bytes

Contents

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

char *to_rna(const char *dna)
{
   size_t len = strlen(dna);
   char *rna = malloc(sizeof(char) * len);

   for (size_t i = 0; i < len; i++) {
      switch (dna[i]) {
      case 'G':
         rna[i] = 'C';
         break;
      case 'C':
         rna[i] = 'G';
         break;
      case 'T':
         rna[i] = 'A';
         break;
      case 'A':
         rna[i] = 'U';
         break;
      default:
         free(rna);
         return NULL;
      }
   }

   return rna;
}

Version data entries

131 entries across 131 versions & 1 rubygems

Version Path
trackler-2.0.8.31 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.30 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.29 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.28 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.27 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.26 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.24 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.23 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.22 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.21 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.20 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.19 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.18 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.17 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.16 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.15 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.14 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.13 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.12 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.8.11 tracks/c/exercises/rna-transcription/src/example.c