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

#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',其后字符不会输出
posted @ 2016-03-12 10:12  iucforever  阅读(1547)  评论(0编辑  收藏  举报