Question: Question 1 [ 5 marks ] Write a function that replaces a specific digit in an int number with another digit and returns the result
Question marks
Write a function that replaces a specific digit in an int number with another digit and returns the result as
an int. Return the same number if the targetreplacement character is not a digit. Use this function header:
int replaceDigitsint number, char target, char replacement
For example:
replaceDigits should return
replaceDigits should return
replaceDigits should return
replaceDigits should return
replaceDigits should return leading zero will not be part of the resulting number
replaceDigits should return
You can assume the number does not have leading zeros eg we will not call replaceDigits
except when the number is actually zero ie we might call replaceDigits
Only include the aquestion.h header file and the function definition and your helper functions, if any
in the source file and name it as aquestionc Do not use recursion in your answer.
please ensure to comment what the important lines of code do code in the context of a first year intro to coding course, and only library you should use is stdio.h not others. Thanks!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
