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.159 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.158 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.157 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.156 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.155 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.154 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.153 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.152 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.151 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.150 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.149 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.148 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.147 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.146 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.145 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.144 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.143 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.142 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.141 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.140 tracks/c/exercises/rna-transcription/src/example.c