Please help me to find out the reason for given compilation errors. If you think there is something wrong then please suggest it to me, as I'm new to programming.
Compilation error:
[Error] request for member 'size' in 'a', which is of non-class type 'char [10]'
[Error] request for member 'size' in 'b', which is of non-class type 'char [10]'
my code is:
#include<iostream>
#include<string>
using namespace std;
int m,n;
void swap(int* p,int* q)//swap
{
int temp = *p;
*p=*q;
*q=temp;
}
int partition(char a[],int l,int h)//partition
{
int pivot=a[h];
int index=l;
for(int i=l;i++;i<h)
{
if(a[i]<pivot)
{
swap(a[i],a[index]);
index++;
}
}
swap(a[h],a[index]);
return(index);
}
void quick_sort(char a[],int l,int h)//sorting
{
while(l<h)
{
int p_index;
p_index=partition(a,l,h);
quick_sort(a,p_index + 1,h);
quick_sort(a,l,p_index - 1);
}
}
void anargram(char a[],char b[])
{
quick_sort(a,0,m);
quick_sort(b,0,n);
if(m==n)
{
for(int k=0;k<m;k++)
{
if(a[k]!=b[k])
{
cout<<"NO\n";
}
}
cout<<"YES\n";
}
else
{
cout<<"NO\n";;
}
}
int main()
{
cout<<"enter the strings";
char a[10],b[10];
cin>>a;
cin>>b;
m = strlen(a);
n= strlen(b);
anargram(a,b);
return 0;
}