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.42 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.41 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.40 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.39 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.38 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.37 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.36 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.35 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.34 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.33 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.32 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.31 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.30 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.29 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.28 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.27 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.26 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.25 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.24 tracks/c/exercises/isogram/src/example.c
trackler-2.2.1.23 tracks/c/exercises/isogram/src/example.c