Write a function string_length() that calculates the length of the input character array. The array will be NULL terminated. i.e. the last element of the array will be '\0'. This null character will not be included in the array length. The function should return the length as an integer value. Use of built-in functions for finding string length is NOT allowed. The function has the following prototype: int string_length(char array[]);
Write a function string_length() that calculates the length of the input character array. The array will be NULL terminated. i.e. the last element of the array will be '\0'. This null character will not be included in the array length. The function should return the length as an integer value. Use of built-in functions for finding string length is NOT allowed. The function has the following prototype:
int string_length(char array[]);
Task 3: Count the number of times a given number appears in an array
Write a function count_num_times() that searches for a given number in the input array. The function should return the number of times the searched number appears in the array. The prototype for the function is given below:
int count_num_times(int array[], int size, int num);
Step by step
Solved in 2 steps with 1 images