Watched Videos

C Arrays Public New



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