Implement the count_views function. It accepts an array of pointers to the Viewer struct, the size of the array, and the character array with the video name. It should return the number of Viewers who have watched a Video with the name video_name.
For example,
Video videos[] = { {.name = "Soccer", .unique_views = 500},
{.name = "Basketball", .unique_views = 1000} };
Viewer viewer = {.username = "Dave", .watched_videos = videos,
.watched_videos_size = 2};
Viewer *viewers[] = { &viewer };
calling count_views(viewers, 1, "Soccer") should return 1.
- Example case: Wrong answer
- Some people did not see the video: Wrong answer
- Various people and videos: Wrong answer
- Strings are dynamically allocated: Wrong answer
Tags
CWould you like to see our other questions?
We have 850+ premium hand-crafted questions for 50+ job skills and 15+ coding languages. We prefer questions with small samples of actual work over academic problems or brain teasers.
Visit our question libraryPrivate Concierge
Send us an email with an explanation of your testing needs and a list of candidates. We will create an appropriate test, invite your candidates, review their results, and send you a detailed report.
Contact Private ConciergeWould you like to see our tests? The following tests contain C related questions:
On the TestDome Blog
Screening Applicants: The Good, the Bad and the Ugly
Since we’re all biased and we use incorrect proxies, why not just outsource hiring to experts or recruitment agencies? After all, they’ve been screening people for many years, so they must know how to do it right?
Not really. I was surprised to discover that many experts disagree with each other. Everybody praises their pet method and criticizes the others. Many of these methods look legitimate, but are based on...