Question
In this task, you will work with the linked list of digits we have created in the lessons up to this point. You need to
In this task, you will work with the linked list of digits we have created in the lessons up to this point. You need to do the followings: A structure definition for the storage of each digit's information.
A main() function to test your code.
The functions createDigit(), append(), printNumber(), freeNumber(), readNumber() and divisibleByThree() (although you may not need to use all of these).
Your task is to write a new function changeThrees() which takes as input a pointer that holds the address of the start of a linked list of digits. Your function should change all of those digits in this linked list that equal 3 to the digit 9, and count how many replacements were made. The function should return this number of replacements.
The provided structure of the main function is as below: int main(void) { struct digit *start; start = readNumber(); printf("The number "); printNumber(start); printf("was modified in %d places. ", changeThrees(start)); printf("The new number is "); printNumber(start); freeNumber(start); return 0;}
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