Question: advanced c programing help pls plssss you in your module development I have provided a Unity test file (intPairUnity.c) downloadable off of the class Canvas

advanced c programing help pls plssss

advanced c programing help pls plssss you in your module development Ihave provided a Unity test file (intPairUnity.c) downloadable off of the classCanvas pages. #ifndef INTPAIR_H #define INTPAIR_H typedef struct { int left, right;} int Pair; void createPair(int Pair* p, int 1, int r); //returns pair (1,r) in P int getLeft(intPair); // returns the left valuein pair int getRight(intPair); // returns the right value in pair voidsetLeft(intPair* p, int); // sets the left value in pair p void

you in your module development I have provided a Unity test file (intPairUnity.c) downloadable off of the class Canvas pages. #ifndef INTPAIR_H #define INTPAIR_H typedef struct { int left, right; } int Pair; void createPair(int Pair* p, int 1, int r); // returns pair (1,r) in P int getLeft(intPair); // returns the left value in pair int getRight(intPair); // returns the right value in pair void setLeft(intPair* p, int); // sets the left value in pair p void setRight(intPair* p, int); // sets the right value in pair p char *toString(intPair); // returns a string representation of a pair; // the pair (1,2) would be represented by "(1,2)" #endif 3 mappings Specification Here is a listing of the specification file mappings.h (also downloadable off of the Canvas class pages) #include #include #ifndef MAPPINGS_H #define MAPPINGS_H typedef struct { intPair *data; // your data array int arraySize, // the size of the array listSize, // number of mappings in list expandSize; // size of each expansion of list as needed } mappings; #define NOT_A_VALUE INT_MIN mappings *createMappings(); // returns a malloc'ed mappings value void destroyMappings (mappings*); // free's both the data array & mappings structure int addMapping (mappings*, intPair p); // adds p to end of list only if left value is unique; // returns index of value added, -1 if nothing is added; 2 // expands array as needed int removeMapping (mappings*, int n); // removes mapping where left == n; returns index of item // removed or -1 if item isn't found bool removeAt (mappings*, int i); // removes mapping at location i, returning true if item // is removed; does nothing and returns false if item // does not exist int funcCall(mappings* f,int 1); // calls function f with l; returns NOT_A_VALUE if i // is not in domain of f bool inDomain(mappings* f,int 1); // returns true if i in domain of f, false otherwise int size(mappings*); // returns number of pairs in list bool isEmpty (mappings*); // returns true if mapping is empty, false otherwise char *mappingsToString(mappings*); // returns a string representation of mapping; an empty // mapping: "[]"; mapping (1,2),(2,3), (3,4) would be // represented by s = "[(1,2),(2,3), (3,4)]"; string returned // should be the exact necessary size to store string, i.e. // strlen(s) = 19 stored in returned char array with 20 cells #endif 4 Sample Driver A sample drive program, mappingsDrive.c, is given below. Note the command used on the com- mand line to compile the entire project. #include #include #include "intPair.h" #include "mappings.h" int main(void) { mappings *m = createMappings(); for(int i = 1; i #include #ifndef MAPPINGS_H #define MAPPINGS_H typedef struct { intPair *data; int arraysize, listSize, expandsize; } mappings; // your data array // the size of the array // number of mappings in list 1/ size of each expansion of list as needed #define NOT_A_VALUE INT_MIN #define EXPAND_SIZE 10 mappings *createMappings(); 1/ returns a malloc'ed mappings value void destroyMappings (mappings*); // free's both the data array & mappings structure int addMapping (mappings*, intPair p); // adds p to end of list only if left value is unique; // returns index of value added, -1 if nothing is added; // expands array as needed int removeMapping (mappings*, int n); // removes mapping where left == n; returns index of item // removed or -1 if item isn't found bool removeAt (mappings*, int i); // removes mapping at location i, returning true if item // is removed; does nothing and returns false if item // does not exist int funcCall(mappings* f, int l); // calls function f with l; returns NOT_A_VALUE if 1 // is not in domain of f bool inDomain(mappings* f, int 1); // returns true if l in domain of f, false otherwise int size(mappings*); // returns number of pairs in list bool isEmpty(mappings*); // returns true if mapping is empty, false otherwise char *mappingsToString(mappings*); // returns a string representation of mapping; an empty // mapping: "[]"; mapping (1,2),(2,3), (3,4) would be // represented by s = "[(1,2), (2,3), (3,4))"; string returned // should be the exact necessary size to store string, i.e. // strlen(s) = 19 stored in returned char array with 20 cells #endif #ifndef INTPAIR_H #define INTPAIR_H typedef struct { int left, right; } intPair; void createPair(intPair* p, int l, int r); // returns pair (1,r) in p int getLeft(intPair); // returns the left value in pair int getRight(intPair); // returns the right value in pair void setLeft(intPair* p,int); // sets the left value in pair p void setRight(intPair* p,int); // sets the right value in pair p char *toString(intPair); // returns a string representation of a pair; // the pair (1,2) would be represented by "(1,2)" #endif Terminal -tcsh 61x5 homebox:~/cprogs/% gcc mappingsDriver.c mappings.c intPair.c homebox:~/cprogs/% a.out [(1,2), (2,4), (3,6), (4,8), (5, 10), (6,12), (7,14), (8,16)] m (3) = 6 homebox:~/cprogs/% 5 Deliverables You should only turn in your mappings module implementation file (i.e. the file con- taining the implementation of everything defined in mappings.n)! This means that the code you submit will not contain a main function. I will test your code with my own test program. Submit your project via Gradescope. Note you need not turn in an executable file, your driver program, or any .h files! you in your module development I have provided a Unity test file (intPairUnity.c) downloadable off of the class Canvas pages. #ifndef INTPAIR_H #define INTPAIR_H typedef struct { int left, right; } int Pair; void createPair(int Pair* p, int 1, int r); // returns pair (1,r) in P int getLeft(intPair); // returns the left value in pair int getRight(intPair); // returns the right value in pair void setLeft(intPair* p, int); // sets the left value in pair p void setRight(intPair* p, int); // sets the right value in pair p char *toString(intPair); // returns a string representation of a pair; // the pair (1,2) would be represented by "(1,2)" #endif 3 mappings Specification Here is a listing of the specification file mappings.h (also downloadable off of the Canvas class pages) #include #include #ifndef MAPPINGS_H #define MAPPINGS_H typedef struct { intPair *data; // your data array int arraySize, // the size of the array listSize, // number of mappings in list expandSize; // size of each expansion of list as needed } mappings; #define NOT_A_VALUE INT_MIN mappings *createMappings(); // returns a malloc'ed mappings value void destroyMappings (mappings*); // free's both the data array & mappings structure int addMapping (mappings*, intPair p); // adds p to end of list only if left value is unique; // returns index of value added, -1 if nothing is added; 2 // expands array as needed int removeMapping (mappings*, int n); // removes mapping where left == n; returns index of item // removed or -1 if item isn't found bool removeAt (mappings*, int i); // removes mapping at location i, returning true if item // is removed; does nothing and returns false if item // does not exist int funcCall(mappings* f,int 1); // calls function f with l; returns NOT_A_VALUE if i // is not in domain of f bool inDomain(mappings* f,int 1); // returns true if i in domain of f, false otherwise int size(mappings*); // returns number of pairs in list bool isEmpty (mappings*); // returns true if mapping is empty, false otherwise char *mappingsToString(mappings*); // returns a string representation of mapping; an empty // mapping: "[]"; mapping (1,2),(2,3), (3,4) would be // represented by s = "[(1,2),(2,3), (3,4)]"; string returned // should be the exact necessary size to store string, i.e. // strlen(s) = 19 stored in returned char array with 20 cells #endif 4 Sample Driver A sample drive program, mappingsDrive.c, is given below. Note the command used on the com- mand line to compile the entire project. #include #include #include "intPair.h" #include "mappings.h" int main(void) { mappings *m = createMappings(); for(int i = 1; i #include #ifndef MAPPINGS_H #define MAPPINGS_H typedef struct { intPair *data; int arraysize, listSize, expandsize; } mappings; // your data array // the size of the array // number of mappings in list 1/ size of each expansion of list as needed #define NOT_A_VALUE INT_MIN #define EXPAND_SIZE 10 mappings *createMappings(); 1/ returns a malloc'ed mappings value void destroyMappings (mappings*); // free's both the data array & mappings structure int addMapping (mappings*, intPair p); // adds p to end of list only if left value is unique; // returns index of value added, -1 if nothing is added; // expands array as needed int removeMapping (mappings*, int n); // removes mapping where left == n; returns index of item // removed or -1 if item isn't found bool removeAt (mappings*, int i); // removes mapping at location i, returning true if item // is removed; does nothing and returns false if item // does not exist int funcCall(mappings* f, int l); // calls function f with l; returns NOT_A_VALUE if 1 // is not in domain of f bool inDomain(mappings* f, int 1); // returns true if l in domain of f, false otherwise int size(mappings*); // returns number of pairs in list bool isEmpty(mappings*); // returns true if mapping is empty, false otherwise char *mappingsToString(mappings*); // returns a string representation of mapping; an empty // mapping: "[]"; mapping (1,2),(2,3), (3,4) would be // represented by s = "[(1,2), (2,3), (3,4))"; string returned // should be the exact necessary size to store string, i.e. // strlen(s) = 19 stored in returned char array with 20 cells #endif #ifndef INTPAIR_H #define INTPAIR_H typedef struct { int left, right; } intPair; void createPair(intPair* p, int l, int r); // returns pair (1,r) in p int getLeft(intPair); // returns the left value in pair int getRight(intPair); // returns the right value in pair void setLeft(intPair* p,int); // sets the left value in pair p void setRight(intPair* p,int); // sets the right value in pair p char *toString(intPair); // returns a string representation of a pair; // the pair (1,2) would be represented by "(1,2)" #endif Terminal -tcsh 61x5 homebox:~/cprogs/% gcc mappingsDriver.c mappings.c intPair.c homebox:~/cprogs/% a.out [(1,2), (2,4), (3,6), (4,8), (5, 10), (6,12), (7,14), (8,16)] m (3) = 6 homebox:~/cprogs/% 5 Deliverables You should only turn in your mappings module implementation file (i.e. the file con- taining the implementation of everything defined in mappings.n)! This means that the code you submit will not contain a main function. I will test your code with my own test program. Submit your project via Gradescope. Note you need not turn in an executable file, your driver program, or any .h files

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!