To check whether two strings are anagrams

To check whether two strings are anagrams


#include <stdio.h>
#include <stdlib.h> 
#include <string.h>
/* using quick sorting */
int compare(char *s,char *v)
{
 while(*s && (*s==*v))
  s++,v++;
 return (*s-*v);
}

void swap(char *x,char *y)
{
 char temp;
 temp=*x;
 *x=*y;
 *y=temp;
}

int partition(char *s,int start,int end)
{
 int pivot=s[end];
 int pindex=start;
 int i;
 for(i=start;i<end;i++)
 {
  if(s[i]<=pivot)
  {
   swap((s+pindex),(s+i));
   pindex++;
  }
 }
 swap((s+pindex),(s+end));
 return pindex;
}

void quicksort(char *s,int start,int end)
{
 int pivot;
 if(start<end)
 {
  pivot=partition(s,start,end);
  quicksort(s,start,pivot-1);
  quicksort(s,pivot+1,end);
 }
}

int main(void) {
 char *s,*v;
 s=(char*)malloc(sizeof(char)*1000);
 v=(char*)malloc(sizeof(char)*1000);
 scanf("%s",s);
 scanf("%s",v);
 quicksort(s,0,strlen(s)-1);
 quicksort(v,0,strlen(v)-1);
 if(compare(s,v)==0)
  printf("YES");
 else
  printf("NO");
 //printf("%s",s);
 return 0;
}