使用putchar输出一段英文
时间: 2023-05-18 08:04:24 浏览: 89
6453demo,c语言putchar源码实现,c语言程序
Sure, here's an example of using putchar to output a string of English text:
```
#include <stdio.h>
int main() {
char str[] = "Hello, world!";
int i = 0;
while (str[i] != '\0') {
putchar(str[i]);
i++;
}
return 0;
}
```
This program declares a string variable `str` containing the text "Hello, world!", and then uses a loop to iterate over each character in the string and output it using putchar. The loop continues until it reaches the null terminator character '\0', which marks the end of the string.
阅读全文