cout<<字符串指针

来源:互联网 发布:pyqt5 windows 编辑:程序博客网 时间:2024/06/06 04:38

操作符也是一种函数调用(语法糖)

#include <iostream>using namespace std;int main(){    char* cp = "hello";    cout << *cp << endl;        //相当于(char c)    cout << cp << endl;         //相当于(char *cp)    cout << (void*)cp << endl;  //相当于(void* cp),指针    system("pause");    return 0;}

这里写图片描述

0 0
原创粉丝点击