How to access string through pointers. I am using turbo C++ and i am having the doubt. please tell me simple example to understand the relationship between pointer and strings
#include<iostream.h>
#include<string.h>
#include<conio.h>
class string
{
char name[100];
public:
string()
{
strcpy(name,"Aab ");}
string(char a[]) //here i am not mentioning the array size how it works??? Please explain the concept behind this
{
strcpy(name,a);
}
void display()
{
cout<<name<<endl;
}
string operator + (string);
int operator < (string);
};
string string::operator +(string c)
{
string temp;
temp=strcat(name,c.name);
return temp;
}
int string::operator <(string c)
{
return strcmp(name,c.name);
}
void main()
{
clrscr();
string a,b("Abc");
a.display();
b.display();
string c=a+b;
c.display();
if(a<b)
cout<<"S1 is greater";
else
cout<<"String is less";
}