Quote Originally Posted by Structure View Post
Code:
#include <stdio.h>
#include <string.h>

int uChars( char *string ) {
 int hasChar[256] = { 0 }, totalUC = 1;
  for ( int i=0; i<(strlen(string)-1); i++ ) 
    hasChar[ string[i] ] = 1 ;
  for ( int i=0; i<256; i++ ) 
    if ( hasChar[i] ) totalUC++;
 return totalUC;
}

int main( int args, char * argv[] ) {
   int result = uChars("testing");
   printf( "[%i] unique characters.", result ); 
  return 0;
}
Interesting. Are you running it on ARM?

Because on Intel you have a security issue as characters are signed, so:

Code:
    hasChar[ string[i] ] = 1
...will trash the stack. This could happen if somebody tries to process UTF-8 Unicode text.