嵌入式编程笔试题集:链表逆置与字符串数组操作.pdfVIP

  • 0
  • 0
  • 约5.55千字
  • 约 6页
  • 2026-01-15 发布于北京
  • 举报

嵌入式编程笔试题集:链表逆置与字符串数组操作.pdf

1.完成使链表逆置函数reverse:链表结点的结构如下:struct

node{intnum;structnode*next;};structnode*

reverse(structnode*head)//head链表头结点{structnode

*p,*temp1,*temp2;if(head==NULL)returnhead;p=head‑

next;head‑next=NULL;while(){temp1=head;;temp2=p;

p=p‑next;;}returnhead;}

2.程序功能是倒序输出各给定的字符串。找出下面程序中的语法错误,并纠正。

#includestdio.hvoidmain(){charstr[5][]={First,Second,Third,

Fourth,Fifth};char*cp[]=[str[4],str[3],str[2],str[1],str[0]];inti;

while(i=5){printf(%c,*(cp+i));i++;}}

3.程序功能是将各个平方根值放入数组中。找出下面程序中的语法错误,并纠正。

#includestdio.hvoidmain(){intmax,a,i;scanf(%d%d,max,a);

doublex[max];

1.完成使链表逆置函数reverse:

链表结点的结构如下:

structnode

{

intnum;

structnode*next;

};

structnode*reverse(structnode*head)//head链表头结点

{

structnode*p,*temp1,*temp2;

if(head==NULL)returnhead;

p=head-next;

head-next=NULL;

while()

{

temp1=head;

;

temp2=p;

p=p-next;

;

}

returnhead;

}

2.程序功能是倒序输出各给定的字符串。找出下面程序中的语法错误,并纠正。

#includestdio.h

voidmain()

{

charstr[5][]={“First”,“Second”,“Third”,“Forth”,“Fifth”};

char*cp[]={str[4],str[3],str[2],str[1],str[0]};

inti;

while(i=5)

{

printf(“%c”,*(cp+i));

i++;

}

}

3.程序功能是将各个平方根值放入数组中。找出下面程序中的语法错误,并纠正。

#includestdio.h

voidmain()

{

intmax,a,i;

scanf(“%d%d”,max,a);

d

文档评论(0)

1亿VIP精品文档

相关文档