到底什麼是”prn_string” ?

以下是從"A Book on C"中擷取出來的題目: Complete the following program by writing a prn_string() function that uses putchar() to print a string as an argument. Remember that strings are terminated by the null charater \0. Teh program uses the strcat() function from the standard library. Its function is given in... show more 以下是從"A Book on C"中擷取出來的題目:

Complete the following program by writing a prn_string() function that uses putchar() to print a string as an argument. Remember that strings are terminated by the null charater \0. Teh program uses the strcat() function from the standard library. Its function is given in the file string.h. The function takes two strings as arguments. It concatenates the two strings and puts the results in the first argument.

#include<stdio.h>
#include<string.h>

#define MAXSTRING 100

void prn_string(char *);

int main(void)
{
char s1[MAXSTRING], s2[MAXSTRING];

strcpy(s1, "Mary, Mary, guite contrary,\n");
strcpy(s2, "how does your garden grow?\n");
prn_string(s1);
prn_string(s2);
strcat(s1, s2); /* concatenate the string */
prn_string(s1);
return 0;
}
.....

我完全看不懂要做什麼耶,

輸入至vim再用gcc編譯後得到:
/tmp/cciEqku5.o: In function `main:
hw1_b.c:(.text+0x5f): undefined reference to `prn_string
hw1_b.c:(.text+0x6d): undefined reference to `prn_string
hw1_b.c:(.text+0x8d): undefined reference to `prn_string
collect2: ld 回傳 1

有沒有大大可以幫忙解答,感激不盡...
Update: void prn_string(char *)
{
... ... ;
... ... ;
... ... ;
}

對不起,我再問的詳細一點...
在這裡要如何寫比較符合原意?
這是我第一次寫這類型的東西...
Update 2: void prn_string(char *c)
{
int i;
for(i=0;c[i]!='\0';i++)
{
putchar(c[i]);
}
}

終於做出來了...
多謝你的幫助...
1 answer 1