Code for c VIO5 Write a function int count_occur(char search, char search_array[], int size) that takes the following pa

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Code for c VIO5 Write a function int count_occur(char search, char search_array[], int size) that takes the following pa

Post by answerhappygod »

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);
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply