Question: Question 21 (14 points) In the following code, write the single word variable / value / function in the blanks provided below (words are case
Question 21 (14 points) In the following code, write the single word variable / value / function in the blanks provided below (words are case sensitive) Now the real point of the previous question. If we have getFieldValStartIdx and getFieldValEndIdx, we can get the text value for each field. For example if a_textInfo is "Cat Name: Mr. Whiskers, Age: 4, Weight: 10.000" and a_fieldName is "Cat Name" then the function will return the c-string "Mr. Whiskers" (the characters between the startIdx and endIdx). makeFieldTxt creates a new dynamic array and copies the value for a field to that array. The new array is returned. char* makeFieldTxt(const char* a_textInfo, const char* a_fieldName) { int startIdx = getFieldValStartIdx(a_textInfo, BLANK 1 ); int endIdx = getFieldValEndIdx(a_textInfo, a_fieldName); if (startIdx >= 0 && endIdx >= 0) { int textLen = (endIdx - BLANK 2 + 1); char* a_dst = (char*) BLANK 3 (function) ((textLen + 1) * sizeof(char)); if (a_dst != BLANK 4 ) { for (int i = 0; i < BLANK 5 ; i++) { a_dst[i] = a_textInfo[i + BLANK 6 ]; } a_dst[textLen] = BLANK 7 (must be a char) ; return a_dst; } else { return NULL; } } return NULL; } Question 21 options: Blank # 1 Blank # 2 Blank # 3 Blank # 4 Blank # 5 Blank # 6 Blank # 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
