#include<iostre am>
using namespace std;
int main()
{
char *p;
p="i love c++";
cout<<p<<"\n";
return 0;
}
Display:i love c++
i am confusing about this kind of assignment. how is the string located? p is a pointer, the value of it should be an address.but why it displays as i love c++ .
if(p) ... why can p judged as true?
using namespace std;
int main()
{
char *p;
p="i love c++";
cout<<p<<"\n";
return 0;
}
Display:i love c++
i am confusing about this kind of assignment. how is the string located? p is a pointer, the value of it should be an address.but why it displays as i love c++ .
if(p) ... why can p judged as true?
Comment