[理工] 資結 - Linked List
題目: 請寫出底下程式之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
→
03/25 21:34, , 1F
03/25 21:34, 1F
→
03/25 22:21, , 2F
03/25 22:21, 2F