How to write a C Program to find the number of unique characters in C programming Language ?
This C Program to find the number of unique characters.
- bool dup = false;
- //find the number of unique characters
- for (i=0; i < iInLen; i++){
- dup = false;
- //Go through every character in iBuf and check if that character is in chars
- for(int k = 0; k < unchar; k++){
- if(iBuf[i] == chars[k]){
- dup = true;
- }
- }
- if(dup == false){
- chars[unchar] = iBuf[i];
- ++unchar;
- }
- }