#include<iostream>
#include<string>
using namespace std;
void main()
{
string s1,s2;
string s3;
cout<<"\n\n Enter first string: ";
cin>>s1;
cout<<"\n\n Enter second string: ";
cin>>s2;
// Address of each character in the strings s1, s2;
for(unsigned i=0,j=0;i<((s1.length()>s2.length())?s1.length():s2.length());i++,j++)
{
if(i<s1.length())
cout<<"\n Address of s1("<<s1[i]<<") = "<<(int)&s1[i];
if(i<s2.length())
cout<<"\t Address of s2("<<s2[j]<<") = "<<(int)&s2[j];
}
system("pause");
}
Comments
Post a Comment