c语言键盘输入字符串转数组
时间: 2023-11-11 14:00:55 浏览: 141
可以使用C语言中的fgets函数来实现键盘输入字符串转数组的功能。具体实现代码如下:
```c
#include <stdio.h>
int main() {
char str[100];
printf("请输入字符串:");
fgets(str, 100, stdin);
printf("转换后的数组为:");
for(int i = 0; str[i] != '\0'; i++) {
printf("%c ", str[i]);
}
return 0;
}
```
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)