Complete the code to declare the frequency array for all ASCII characters.
int freq[[1]] = {0};
The frequency array size should be 256 to cover all ASCII characters.
Complete the code to increment the frequency count of each character in the string.
freq[(unsigned char)str[[1]]]++;The loop variable 'i' is used to access each character in the string.
Fix the error in the loop condition to find the first non-repeating character.
for (int [1] = 0; str[i] != '\0'; i++) {
The loop variable should be 'i' to match the condition and increment.
Fill both blanks to check if the character frequency is 1 and return it.
if (freq[(unsigned char)str[[1]]] [2] 1) { return str[i]; }
We check if the frequency of the character at index 'i' is equal to 1.
Fill all three blanks to complete the function that returns the first non-repeating character or '_' if none found.
char firstNonRepeatingChar(char *str) {
int freq[[1]] = {0};
for (int [2] = 0; str[[2]] != '\0'; [2]++) {
freq[(unsigned char)str[[2]]]++;
}
for (int i = 0; str[i] != '\0'; i++) {
if (freq[(unsigned char)str[i]] [3] 1) {
return str[i];
}
}
return '_';
}The frequency array size is 256, the loop variable is 'i', and the frequency check uses '=='.
