Question You should perform a walkthrough on the following code. This means… You should perform a walkthrough on the following code. This means you should write down every declaration that is performed and every line which is executed. If a line is executed more than once, you should wite it down every time it is executed. Similarly, lines which are not executed are not written down. As you write down the lines, you must show the values of the variables being calculated. Below is the code needed to be used for walkthrough. Basically show step for step how this program is executed and after each iteration how different variables change in value. The column on the left indicates the line number. 0001 #include 0002 0003 #define MAX_PICTURES 100004 #define MAX_DESCRIPTION 630005 0006 struct Dimension0007 {0008 double width;0009 double height;0010 };0011 0012 struct PictureSize0013 {0014 char desc[MAX_DESCRIPTION + 1];0015 struct Dimension;0016 };0017 0018 int getFrameType(struct PictureSize* original, struct Dimension frames[], 0019 int nframes, struct Dimension* final)0020 {0021 int i, frame = -1;0022 double tmp, aspect;0023 const double mat = 0.4;0024 aspect = original->width / (*original).height;0025 final->width = (int)(original->width * (1 + mat) + 0.5);0026 final->height = (int)(original->height * (1 + mat) + 0.5);0027 if (aspect < 1.0)0028 {0029 tmp = final->width;0030 final->width = final->height;0031 final->height = tmp;0032 }0033 0034 for (i = 0; i < nframes; i++)0035 {0036 if (final->width <= frames[i].width && final->height <= frames[i].height)0037 {0038 frame = i;0039 i = nframes;0040 }0041 }0042 return frame;0043 }0044 0045 int main(void)0046 {0047 struct PictureSize gallery[MAX_PICTURES] = {0048 {"Aunt Mabel", 28,35}, {"Uncle Jake", 18, 14}0049 };0050 struct Dimension frameSizes[MAX_PICTURES] = { {20, 25}, {28, 36}, {41,51}, {61,91}, (76,102) },0051 finalSize;0052 int i, numPicts = 2, numFrames = 5, frame;0053 0054 for (i = 0; i < numPicts; i++)0055 {0056 frame = getFrameType(&gallery[i], frameSizes, numFrames, &finalSize);0057 printf("The picture of %s with mat is %.0lf x %.0lf and requires a %.0lf x %.0lf framen",0058 gallery[i].desc, finalSize.width, finalSize.height, frameSizes[frame].width,0059 frameSizes[frame].height);0060 }0061 return 0;0062 } Computer Science Engineering & Technology C++ Programming COMPUTER S 1307 Share QuestionEmailCopy link Comments (0)