作者thank1984 (thankakimo)
看板Grad-ProbAsk
标题[理工] 资结 - Linked List
时间Wed Mar 25 19:34:52 2009
题目: 请写出底下程式之output
a)
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
char ch;
struct node *link;
}node_t, *list_t;
void tupni(list_t *ptr, const char *s){
if(*s){
node_t *p= malloc(sizeof(node_t));
p->ch = *s;
printf("%s",s);
tupni(&p->link,s+1); //这行小弟看不懂
printf("%c",p->ch)
*ptr = p;
}
else
*ptr = NULL;
}
int main(void){
list_t p = NULL;
tupni(&p,"abcd");
system("Pause");
/*Draw the list p*/
return 0;
}
b)Draw the linked list pointed by p when the program runs to the comment
Draw the list p .
问题:请问各位大大a)小题那行是代表什麽意思呢 第一个回圈跑出abcd 那s+1指的是??
b)小题是只要划出Linked List 的内容吗?? 烦请解答 感谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.116.171.19
1F:→ crecy:17986 03/25 21:34
2F:→ thank1984:感谢C大 03/25 22:21