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.119 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.118 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.117 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.116 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.115 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.114 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.113 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.111 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.110 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.109 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.108 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.107 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.106 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.105 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.104 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.103 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.102 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.101 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.100 tracks/c/exercises/rna-transcription/src/example.c
trackler-2.2.1.99 tracks/c/exercises/rna-transcription/src/example.c