填空题

下面程序的功能是输出数组s中最大元素的下标,请填空。
main( )
int k,p,s[ ]=1,-9,7,2,-10,3;
for(p=0,k=p;p<6;p++)
if(s[p]>s[k])______
printf("%d\n",k);

【参考答案】

k=p;
<上一题 目录 下一题>
热门 试题

填空题
以下程序的功能是建立一个带有头结点的单向链表,链表结点中的数据通过键盘输入,当输入数据为-1时,表示输入结束(链表头结点的data域不放数据,表空的条件是ph->next==NULL),请填空。 #include <stdio.h> struct list int data;struct list *next;; struct list *creatlist( ) struct list *p,*q,*ph;int a;ph=(struct list*)malloc(sizeof(struct list)); p=q=ph;printf( Input an integer number;entre-1 to end: n ); scanf( %d ,&a); while(a!=-1) p=(struct list*)malloc(sizeof(struct list)); [14] =a;q->next=p; [15] =p;scanf( %d ,&a); p->next=’ 0’;return(ph); main( ) stuct list * head;head=creatlist();
填空题
以下程序的运行结果是______。 #include <stdio.h> long fib(int g) switch(g) case 0:return 0; case 1: case 2:return 1; return(fib(g-1) +fib(g-2)); main( ) long k; k=fib(5); printf( k=%51d n ,k);
相关试题
  • 以下程序的功能是:求出数组x中各相邻两个...
  • 设有以下程序,为使之正确运行,请在横线中...