在 C 語言中,可以使用以下方法去掉空格:文章來源地址http://www.zghlxwxcb.cn/news/detail-519344.html
- 使用
scanf
和%[^ ]
的格式字符:
#include <stdio.h>
int main(void) {
char input[100];
int n;
n = scanf("%[^ ]", input);
printf("輸入的字符串是:%s\n", input);
return 0;
}
文章來源:http://www.zghlxwxcb.cn/news/detail-519344.html
到了這里,關(guān)于如何用c語言去掉空格的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!