Sha256: b74f7252aadc58bb62dec9ea50943e2f0e4504735ba8dffec50f2ae7314d14a1

Contents?: true

Size: 550 Bytes

Versions: 265

Compression:

Stored size: 550 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 = calloc(sizeof(char), len + 1);

   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

265 entries across 265 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.179 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.178 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.177 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.176 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.175 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.174 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.173 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.172 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.171 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.170 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.169 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.167 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.166 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.165 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.164 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.163 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.162 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.161 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.160 tracks/c/exercises/rna-transcription/src/example.c