1. Engineering
  2. Computer Science
  3. create a header file called clockh with the following contents...

Question: create a header file called clockh with the following contents...

Question details
  • Create a header file called clock.h with the following contents. This will be the interface you will implement as part of this and subsequent tasks. Fill in the definition of the clock data structure that will be used to store your ASCII clock -- the design is entirely up to you.
#ifndef CLOCK_H_
#define CLOCK_H_

typedef struct {
  // TODO: Define your ASCII clock data structure here. 
} ClockType;

// Initialize the clock data structure 
void initClock( ClockType *clock );

// Print an ASCII clock showing cur_time as the time 
void printClock( const time_t cur_time, const ClockType *clock );

// Free up any dynamically allocated memory in the clock
void cleanClock( ClockType *clock);

#endif /* CLOCK_H_ */

In a source file called clock.c, implement the functions in clock.h: initClock, printClock, cleanClock. Do not just print the time on a single line, make each digit at least 8 lines tall for the mandatory tasks in this assignment (as shown in the example output below). You may find the C ctime function helpful. Learn how to use it and related functions from manual pages, cppreference.com or any other reference of your choice.

a @a 66 f a @@a@

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution