c++字符串指针地址的输出

#include <iostream>
using namespace std;
int main()
{
    char *p=NULL;
    p="computer";
    cout<<p;
    return 0;
}

输出          computer
而不是字符串的地址,如果要输出地址

可以 用     printf("%p",p);

或        

cout << static_cast<const void *>(p)
posted @ 2014-01-20 22:16  zj一乐  阅读(540)  评论(0编辑  收藏  举报