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.5.14 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.13 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.12 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.11 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.10 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.9 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.8 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.7 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.6 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.5 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.4 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.3 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.2 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.1 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.5.0 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.4.0 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.3.9 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.3.8 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.3.7 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.0.3.6 tracks/c/exercises/rna-transcription/src/example.c