Code for c VIO5 Write a function int count_occur(char search, char search_array[], int size) that takes the following pa
Posted: Fri Apr 29, 2022 6:55 am
Code for c
VIO5 Write a function int count_occur(char search, char
search_array[], int size) that takes the following parameters: -
the character to find - a character array - the size of the array
The function should return how many times the given character
occurs in the array.
Note: do not print anything in the function.
For example: Test Result int size = 5; char search_array[] =
{'H','E','L','L','O'}; int result = count_occur('L', search_array,
size); printf("%d", result); 2 int size = 10; char search_array[] =
{'H','E','l','l','O','W','O','R','L','D'}; int result =
count_occur('L', search_array, size); printf("%d", result); 1 int
size = 10; char search_array[] =
{'H','E','l','l','O','W','O','R','L','D'}; int result =
count_occur('U', search_array, size); printf("%d", result);
VIO5 Write a function int count_occur(char search, char
search_array[], int size) that takes the following parameters: -
the character to find - a character array - the size of the array
The function should return how many times the given character
occurs in the array.
Note: do not print anything in the function.
For example: Test Result int size = 5; char search_array[] =
{'H','E','L','L','O'}; int result = count_occur('L', search_array,
size); printf("%d", result); 2 int size = 10; char search_array[] =
{'H','E','l','l','O','W','O','R','L','D'}; int result =
count_occur('L', search_array, size); printf("%d", result); 1 int
size = 10; char search_array[] =
{'H','E','l','l','O','W','O','R','L','D'}; int result =
count_occur('U', search_array, size); printf("%d", result);