To print address in c++

           There’s a difference to print address in c++

#include<iostream>
using namespace std;
int main()
{
char str1[]=”hello fuckers”;
char *p1=”fuck off”;
char *p2;
p2=str1;
cout<<endl<<str1<<endl<<p1;
cout<<endl<<p2;
cout<<endl<<(void *)str1; //address
cout<<endl<<(void *)p1;
cout<<endl<<(void *)p2;
return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s