Question: C++ List bugs and inadequacies in the following function: struct IntCount { int i; //integer whose occurrences are counted size_t count;//its count } /** Return

C++ List bugs and inadequacies in the following function: struct IntCount { int i; //integer whose occurrences are counted size_t count;//its count } /** Return IntCount which counts number of occurrences of * int i in int array ints[]. */ const IntCount* getIntCount(int i, int ints[]) { IntCount intCount; intCount.i = i; for (int i = 0; i < sizeof(ints); i++) { if (ints[i] = i) intCount.count += 1; } return &intCount; } Provide code which fixes the problems. You are allowed to change the function interface as long as you do return an `IntCounts` structure which counts the number of occurrences of `i` in array `ints[]`.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!