getchar输入字符串
时间: 2023-10-17 11:38:02 浏览: 99
getchar函数用于输入字符,而不是字符串。通过使用getchar函数,可以逐个读取字符并将其存储在变量中。在一个while循环中,可以使用条件语句来判断字符是否等于换行符\n,从而统计字符的个数。 输入的字符串不可以包含空格、制表符或者换行符,否则会影响输入的结果。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [c语言之getchar函数输入字符](https://blog.csdn.net/m0_56698546/article/details/127143873)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [关于字符串scanf,gets,getchar输入总结!!!](https://blog.csdn.net/cnjdd/article/details/130802338)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [用getchar函数输入一串字符,依次读入](https://download.csdn.net/download/pohuaixianglin/8602807)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文