Question: I need help completing this function. The first picture is the directions for the parseString function and the second is the kw26-m1.c. Thank you. This
I need help completing this function. The first picture is the directions for the parseString function and the second is the kw26-m1.c. Thank you.

This is the kw26.h file if needed
#ifndef __KW26_H
#define __KW26_H
#define MAX40 40
int fib(int n)
{
//base cases: F(0) = 0, F(1) = 1
if (n
return n;
//definition of Fibonacci: F(n) = F(n - 1) + F(n - 2)
return fib(n - 1) + fib(n - 2);
};
typedef struct Int40
{
// a dynamically allocated array to hold a 40
// digit integer, stored in reverse order
int *digits;
} Int40;
typedef struct kw26RatingStruct{
char *NID; //pointer to a malloc'ed buffer for the NID
float degreeOfDifficulty; //1.0 for super easy to 5.0 for insanity++
float duration; // Hours spent writing, reading,
// designing & building the code
} kw26RatingStruct;
char *cryptoVariableFilename; // for the filename
int seed;//to seed the RNG or not
int nFib; //control the number of Fibonacci numbers to calculate
// F[0] is loaded with the cryptovariable
Int40 *cryptoVariable; // 40 digits used to start the F[x]
// F[1] is loaded with the hwConfigvariable
Int40 *hwConfigVariable; // 40 digits of psuedo or real
// randomness to start the F[x]
// Functional Prototypes
Int40 *kw26Add(Int40 *p, Int40 *q);
Int40 *kw26Destroyer(Int40 *p);
Int40 *fibKw26(int n, Int40 *first, Int40 *second);
void kw26Rating(void);
Int40 *parseString(char *str);
Int40 *loadHWConfigVariable(int doSeed);
Int40 *loadCryptoVariable(char *inputFilename);
Int40 *loadPlainText(char *inputFilename);
Int40 *encrypt(Int40 *key, Int40 *inputText);
#endif
Int40 parseString(char str); Description:Coert a number from string format to Int-40 format. (For example function calls, Special Notes: I the empty string() is passed to this function, eat as a zero ("O"). If any see kw26-ml.c.) dynamic memory allocation functions fail within this fuction, or if str is NULL, return NULL, be careful to avoid memory leaks when you do so. You may assume the string will only contain ASCII digits '0' through 9' and the letters 'A' thru 'F either upper or lower case, for a minimum of 40 digits In the event that 40 digits are not in the input string print an error message to STDERR andl with leading zeroes. Also, if there are more than 40 digits in the input string use the first 40 digits in the string. Returns: A pointer to the newly allocated Int-40 strut, or NULL if dynamic memory allocation fails or if the input str is NULL The subseript of 16 indicate base 16. However the two expressions 106 and 10, are equivalent and used equally often
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
