002_C语言常用字符串处理函数
一、puts函数(输出字符串函数)
#include <stdio.h>
int main()
{
char str[30];
for(int i=0;i<5;i++)
scanf("%c",&str[i]);
for(int j=0;j<5;j++)
printf("%c",str[j]);
printf("\n");
puts(str);//输出字符串"换行\n等会被转义""
char str2[] = {"Hello arun"};
puts(str2);
return 0;
}
输出=>
➜ 20190427 gcc putsExample.cpp -o putsExample ➜ 20190427 ./putsExample abcdef56 abcde abcde Hello arun
二、gets函数

浙公网安备 33010602011771号