您的位置:首页 > 编程语言 > C语言/C++

C-C++字符输出时遇到字符'\n','\0'的区别

2016-03-14 12:22 260 查看
#include "iostream"
#include "stdio.h"
#include "stdio_ext.h"
#include "stdlib.h"
#include "string.h"
using namespace std;
int main(int argc, char const *argv[])
{
char buf[] = "www\nqqqq";
char buf1[] = "www\0qqqq";
cout<<"buf="<<buf<<endl;
cout<<"-----"<<endl;
cout<<"buf1="<<buf1<<endl;

return 0;
}

输出时遇到字符'\n',输出字符会换行
输出时遇到字符'\0',其后字符不会输出
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: