Expected b4 arAnagram

here is the code can't figure to make it work

#include<stdio.h>
#include<string.h>


void quickSort(char *arr, int si, int ei);

bool  areAnagram(char *str1, char *str2)
{

int n1 = strlen(str1);
int n2 = strlen(str2);

if (n1 != n2)
return false;

quickSort (str1, 0, n1-1);
quickSort (str2, 0, n2 -1);

for(int i=0; i <n1; i++)
if (str1 != str2)
return false;

return true;
}
void exhange(char *a, char*b)
{
char temp;
temp = *a;
*a = *b;
*b = temp;
}
int partition(char A[], int si, int ei)
{
char x = A[ei];
int i = (si-1);
int j;
for(j=si; j<= ei-1; j++)
{
if(A[j] <= x)
{
i++;
exchange(&A[i+1], &A[ei]);
}
}
exchange (&A[i+1], &A[ei]);
return (i+1);
}
void quickSort(char A[], int si, int ei)
{
int pi;
if(si<ei)
{
pi = partition(A, si, ei);
quickSort(A, si, pi-1);
quickSort(A, pi+1, ei);
}
}
int main()
{
char str1;
char str2;
printf("Enter the first string");
scanf("%d\n", str1);
printf("Enter the second string");
scanf("%d\n", str2);
if (areAnagram(str1, str2))
printf("The two strings are anagram of each other");
else
printf("The two strings are not anagram of each other");
return 0;
                                                                                                           

                                                                                                           

---------- Post updated at 09:07 PM ---------- Previous update was at 08:02 PM ----------

this code suppose the compare two strings when you input but there is an error and i can't find a way to solve.

Try this

#include<stdio.h>
#include<string.h>


void quickSort(char *arr, int si, int ei);

bool  areAnagram(char *str1, char *str2)
{

int n1 = strlen(str1);
int n2 = strlen(str2);

if (n1 != n2)
return false;

quickSort (str1, 0, n1-1);
quickSort (str2, 0, n2 -1);

for(int i=0; i <n1; i++)
if (str1 != str2)
return false;

return true;
}
void exchange(char *a, char*b)
{
char temp;
temp = *a;
*a = *b;
*b = temp;
}
int partition(char A[], int si, int ei)
{
char x = A[ei];
int i = (si-1);
int j;
for(j=si; j<= ei-1; j++)
{
if(A[j] <= x)
{
i++;
exchange(&A[i+1], &A[ei]);
}
}
exchange (&A[i+1], &A[ei]);
return (i+1);
}
void quickSort(char A[], int si, int ei)
{
int pi;
if(si<ei)
{
pi = partition(A, si, ei);
quickSort(A, si, pi-1);
quickSort(A, pi+1, ei);
}
}
int main()
{
char str1[255];
char str2[255];
printf("Enter the first string: ");
scanf("%s", &str1);

printf("Enter the second string: ");
scanf("%s", &str2);
if (areAnagram(str1, str2))
printf("The two strings are anagram of each other\n");
else
printf("The two strings are not anagram of each other\n");
return 0;
}

Eg:

$ g++ -o b4 b4.cpp
$ ./b4
Enter the first string: Test
Enter the second string: tseT
The two strings are not anagram of each other

---------- Post updated at 12:55 PM ---------- Previous update was at 12:48 PM ----------

Note this function corrupts the input strings and will most likley crash with a memory violation if you passed constants into it eg:

if (areAnagram(str1, "unix"))

Best practice would be to manipulate copies of the strings and leave the input params unchanged.