字符串和字符串函数 字符串输出

1.puts函数ide

自动在输出时添加换行符,遇到空字符中止函数

2.fputs函数spa

第二个参数指明输出方式,stdoutget

不会自动添加换行符it

3.配对使用io

gets丢弃换行符,puts自动添加换行符class

fgets存储换行符,fput不会自动添加换行符sso

  
  
  
  
  1. #include<stdio.h> 
  2. #define MAX 81 
  3.  
  4. int main(void){ 
  5.     char line[81]; 
  6.     while(gets(line)){ 
  7.         puts(line); 
  8.     } 
  9.     while(fgets(line,81,stdin)){ 
  10.         fputs(line,stdout); 
  11.     } 
  12. }  

4.printfword

不会自动添加换行符,须要本身指定di

相关文章
相关标签/搜索