Question: I haven't done any C programming for over a year and i'm completely lost. The code in the image was just the template we were

I haven't done any C programming for over a year and i'm completely lost. The code in the image was just the template we were given. The background info we were given is: " C's builtin types have a limited range of values, e.g. a typical int can hold values in the range 231-1 .. -231. Occasionally it would be useful to be able to manipulate much larger numbers. The aim for this lab is to start implementing a data type BigNum which can deal with such numbers.
To make it feasible to implement in a lab class, the BigNum data type has a very simple (and inefficient) structure. Each BigNum has an array of char values, where each char should be a decimal digit ('0'..'9')."
Exercise You are required to complete the implementation of the BigNum so that the add program works as expected. Specifically, you need to provide implementations for the following functions vold in?tBigNum(Bignum *n, int Nbytes) Initialise a BigNum object by seting the byte counter and by creating (malloc'ing) an array of length Nbytes. Use an assert() to check whether the array was successfully created. No return value void addBigNums (BigNum n, BigNum m, BigNum res) Add the values in n and m and store the result in res. If res is not initially large enough to hold the result, increase its size. No retun value. Note that this function (and all the others a3 well) use the convention that if the function only reads a struct parameter, then it's passed by value. However, if the intention of the function is to change the value of the struct, then it is passed by reference (i.e. using a pointer) int scanBigNum(char *s, BigNum n) Convert a string into a BigNum. Ignores any leading space characters in the string. If the first non-space is a digit, then scan to a non-digit (or end of string) and note where the last digit occurs. Then scan the digit-rich region of the string i.e. a contiguous sequence of digits) and place them in the appropriate location in the Bignum's array. If the string does not contain a sequence of digits after the spaces, then return O; otherwise return 1 void shonBigNum(BigNum n) Display the contents of a BigNum on standard output. Ignore leading 0' digits and then display all digits to the (lower) end of the array. If there are no non-0. cigits in the array, then print a single B. Do not print any other characters except the digits. No return value We recommend that you implement the functions in the following order: initBigNum(), showBigNum() (possibly inserting some data manually into the digits array), scanBigNum), addBigNums ). Altogether, it will require around 50 lines of C code. Once the program is workin g, you should be able to do thinga like: $.fadd 1080090000 42 Sun of 1888000880 and 42 is 1008800842 ./add 987654321987654321987654321 98765987659876598765 Sun of 987654321987654321987654321 and 987659B7659876598765 is 9876544287536419 18642539 6 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
