Question
Write a program that displays the day of the week corresponding to a user-entered input number between 1 and 7 (for Sunday to Saturday). For
Write a program that displays the day of the week corresponding to a user-entered input number between 1 and 7 (for Sunday to Saturday). For example, in response to an input of 2, the program displays the name Monday.
a. Use %s as the format specifier in printf for displaying the day (eg. Monday).
2) Also, display the base address of the character string containing the displayed day.
a. Use %p as the format specifier in printf for displaying the address.
3) Also display the data pointed to by the pointer to the displayed day.
a. -Use %c as the format specifier in printf for displaying the data.
4) Use an array of pointers called *day[], as the data structure for the days of the week in this program. See slides 25,26 of lecture 10.
5) The output of your program should have this format:
a. "Day
b. The base address of this string is
c. This address points to
6) Loop the program continually so new choices can be entered.
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