[問題] 程式題,請幫幫忙~>"<
要寫出這個程式的output
但是我打進電腦,一直有錯,我debug不出來,只好用腦子想.......
有些地方打結了,不太懂。
#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); //這個應該是 abcd
tunpi(&p->link, s+1); // &p->link 不懂,p的位址的link是什麼?
printf("%c",p->ch); s+1也不懂,s指向下一筆char資料,可是
*ptr = p; 除了abcd還有什麼下一筆???
}
else
*ptr = NULL;
}
int main(void) {
list_t p =NULL;
tupni(&p, "abcd");
/* draw the list p */
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.139.172.204
推
03/23 00:28, , 1F
03/23 00:28, 1F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):