填空题
以下程序把3个NODETYPE型的变量链接成一个简单的链表,并在while循环中输出链表结点数据域中的数据。请填空。
#include<stdio.h>
struct node
{ int data; struct node *next; };
typedef struct node NODETYPE;
main()
{ NODETYPE a, b, c, *h, *p; a.data=10; b.data=20; c.data=30; h=&a;
b.next=&b; b.next=&c; c.next=’\0’;
p=h;
while(p){printf("%d", p->data);______;}
}
【参考答案】
p=p->next
热门
试题
填空题
以下程序运行后的输出结果是______。#include<stdio.h>void fun(int *a){ a[0]=a[1]; }main(){ int a[10]={10, 9, 8, 7, 6, 5, 4, 3, 2, 1}, i;for(i=2; i>=0; i--) fun(&a[i]);for(i=0; i<10; i++) printf( %d , a[i]);printf( n );}