Sha256: 505ae46abb3c3c58d0a2ff0921e2ed3e394d2d3aad34fcc34b76ea721b10831b

Contents?: true

Size: 524 Bytes

Versions: 57

Compression:

Stored size: 524 Bytes

Contents

#include "isogram.h"
#include <ctype.h>
#include <stddef.h>
#include <stdint.h>

bool isIsogram(const char phrase[])
{
   uint32_t usedLetters = 0;

   if (phrase == NULL)
      return false;

   for (int16_t i = 0; phrase[i] != '\0'; ++i) {
      if (isalpha(phrase[i])) {
         uint8_t bitNumber = toupper(phrase[i]) - 'A';
         uint32_t bitMask = 1 << bitNumber;

         if ((usedLetters & bitMask) > 0)
            return false;
         else
            usedLetters |= bitMask;
      }
   }

   return true;
}

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
trackler-2.2.1.2 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.1 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.0 tracks/c/exercises/isogram/src/example.c
trackler-2.2.0.6 tracks/c/exercises/isogram/src/example.c
trackler-2.2.0.5 tracks/c/exercises/isogram/src/example.c
trackler-2.2.0.4 tracks/c/exercises/isogram/src/example.c
trackler-2.2.0.3 tracks/c/exercises/isogram/src/example.c
trackler-2.2.0.2 tracks/c/exercises/isogram/src/example.c
trackler-2.2.0.1 tracks/c/exercises/isogram/src/example.c
trackler-2.2.0.0 tracks/c/exercises/isogram/src/example.c
trackler-2.1.0.55 tracks/c/exercises/isogram/src/example.c
trackler-2.1.0.54 tracks/c/exercises/isogram/src/example.c
trackler-2.1.0.53 tracks/c/exercises/isogram/src/example.c
trackler-2.1.0.52 tracks/c/exercises/isogram/src/example.c
trackler-2.1.0.51 tracks/c/exercises/isogram/src/example.c
trackler-2.1.0.50 tracks/c/exercises/isogram/src/example.c
trackler-2.1.0.49 tracks/c/exercises/isogram/src/example.c