writecstring
时间: 2023-12-13 20:06:11 浏览: 24
Sure, I can help you with that!
In C, a string is an array of characters that ends with a null character '\0'. To write a string in C, you can use the printf() function or the puts() function.
Here's an example using printf():
```
#include <stdio.h>
int main() {
char str[] = "Hello, world!";
printf("%s\n", str);
return 0;
}
```
Here's an example using puts():
```
#include <stdio.h>
int main() {
char str[] = "Hello, world!";
puts(str);
return 0;
}
```
Both of these programs will output the string "Hello, world!" to the console. I hope this helps! Let me know if you have any more questions.
相关推荐
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)