相关疑难解决方法(0)

打印char数组的地址

int *i = new int(1);
cout << i << endl; 
Run Code Online (Sandbox Code Playgroud)

将打印整数的地址.

    char *c="cstring";
    cout << c << endl;
    cout << &(*c) << endl;
Run Code Online (Sandbox Code Playgroud)

两者都会打印"cstring".我想这个行为可以简单地通过ostream& operator<< (ostream& out, const char* s );IOstream库中的实现来解释.

但是,如果你真的想要打印数据c的地址怎么办呢?

c++ cout char ostream

3
推荐指数
1
解决办法
2454
查看次数

标签 统计

c++ ×1

char ×1

cout ×1

ostream ×1