Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming in C Write a function called maximum_occurences() that accepts a pointer to a string (consisting of alphanumeric and whitespace characters only), a pointer to

Programming in C

Write a function called maximum_occurences() that accepts a pointer to a string (consisting of alphanumeric and whitespace characters only), a pointer to an array of struct occurrences, a pointer to an integer, and a pointer to a character as arguments. The structure is defined as follows:

typedef struct occurrences

int num_occurrences;

double frequency;

} Occurrences;

The function determines the frequency of each character found in the array. The frequency is defined as: number of one character symbol / total number of characters. The function should use the second array argument (of struct occurrences) to keep track of the frequency of each character. Also, it must return, through the pointers, the maximum number of occurrences of any one character and the corresponding character for which the maximum represents. Thus, for a string such as test string, t occurs 3 times, which is the maximum occurrences for any one character in the string.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago