该函数put_string被赋予一个字符串。它应该将字符串写入标准输出,然后是换行符。它应该使用fputc函数来做到这一点。您不得使用任何其他功能。要用make构建代码
#include <stdio.h>
#include "put_string.h"
// print s to stdout with a new line appended using fputc (only)
void put_string(char *s) {
// PUT YOUR CODE HERE
}
#include <stdio.h>
#include "put_string.h"
void put_string(char *s) {
int i=0;
while(s[i] != '\0')
{
fputc(s[i],stdout);
i++;
}
fputc('\n',stdout);
}
int main()
{
char s[] = "hello";
put_string(s);
return 0;
}