正在加载图片...
-2- Problem 1-Short answer (15 points) la)Suppose that the integer array 1ist has been declared and initialized as follows: #define NElements 5 int list[NElements]=10,20,30,40,50 } This declaration sets up an array of five elements with the initial values shown in the diagram below: list 10 20 30 40 50 Given this array,what is the effect of calling the function Mystery(list,NElements); if Mystery is defined as: void Mystery(int array[],int n) int i,tmp; tmp array[n -1]; for (i=1;i<n;it+){ array[i]array[i -1]; } array[o]tmp; Work through the function carefully and indicate your answer by filling in the boxes below to show the final contents of list: list– 2 – Problem 1—Short answer (15 points) 1a) Suppose that the integer array list has been declared and initialized as follows: #define NElements 5 int list[NElements] = { 10, 20, 30, 40, 50 }; This declaration sets up an array of five elements with the initial values shown in the diagram below: list 10 20 30 40 50 Given this array, what is the effect of calling the function Mystery(list, NElements); if Mystery is defined as: void Mystery(int array[], int n) { int i, tmp; tmp = array[n - 1]; for (i = 1; i < n; i++) { array[i] = array[i - 1]; } array[0] = tmp; } Work through the function carefully and indicate your answer by filling in the boxes below to show the final contents of list: list
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有