Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C code that stores dates in an array of structures and implements the basic functionality provided below. The structure type you'll define has
Write a C code that stores dates in an array of structures and implements the basic functionality provided below. The structure type you'll define has a tag name Time_info and it stores day, month and year information. Implement 3 functions: . insert: takes a Time_info variable and inserts it into an array of Time_info structures at the specified index. On success it returns 1 and on fail (invalid index) it returns 0. find: Takes an array of Time_info structures, a day, a month and a year and looks for a Time_info structure with the specified day, month and the year. It returns a pointer to Time_info structure if it's found in the array, NULL otherwise. print: takes a Time_info variable and print its contents. In main function Y create an array of Time_info structures that stores valid random dates between 01.01.1990 - 31.12.2021. You can decide on the size of this array as you wish. Create a Time_info variable and initialize it with a date you choose and test your functions with it. >If inserting a Time_info variable into the array fails due to an invalid index print the message "insertion failed..." on standard error stream. If a Time_info variable is found in the array, print its index on the screen along with its contents using the print function you wrote. If a Time_info variable is NOT found in the array, print the message "Birthday not found" on the screen. Here's a sample output for the last 3 bullets listed above [harubyu@arch-zenbook 14 exams]$ clang timestamps.c-o timestamps [harubyu@arch-zenbook 14 exams]$ ./timestamps
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started