正在加载图片...
-9- static int *Weird(int array[],int n) int *p,i; p array; for (i 1;i<n;i++){ if (*p array[i])p array +i; (*p)--; return (p); /* Function:Checkpoint Usage:Checkpoint(ckpt,array,n); This function is used to display checkpoints in the program The output consists of the checkpoint number followed by the contents of the first n elements of array. */ static void Checkpoint(int ckpt,int array[],int n) int i; printf("Checkpoint &d:{",ckpt); for (i=0;i<n;i++){ if (i>0)printf(",") printf("8d",array[i]); printf(")\n"); The checkpoint function does exactly what its comments say it does:display the contents of an array preceded by a checkpoint number.Thus,to answer this problem,all you have to do is show the output at each of the calls to checkpoint.The results of the first call are filled in as an example. Answer to problem 6: Checkpoint0:{10,11,12,13,14J Checkpoint 1: Checkpoint 2: (Space to show your scratch work appears on the following page)– 9 – static int *Weird(int array[], int n) { int *p, i; p = array; for (i = 1; i < n; i++) { if (*p < array[i]) p = array + i; } (*p)--; return (p); } /* * Function: Checkpoint * Usage: Checkpoint(ckpt, array, n); * ---------------------------------- * This function is used to display checkpoints in the program * The output consists of the checkpoint number followed by * the contents of the first n elements of array. */ static void Checkpoint(int ckpt, int array[], int n) { int i; printf("Checkpoint %d: { ", ckpt); for (i = 0; i < n; i++) { if (i > 0) printf(", "); printf("%d", array[i]); } printf(" }\n"); } The Checkpoint function does exactly what its comments say it does: display the contents of an array preceded by a checkpoint number. Thus, to answer this problem, all you have to do is show the output at each of the calls to Checkpoint. The results of the first call are filled in as an example. Answer to problem 6: Checkpoint 0: { 10, 11, 12, 13, 14 } Checkpoint 1: Checkpoint 2: (Space to show your scratch work appears on the following page)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有