In the standard qsort() function declared in <stdlib.h>, it crashes when I do the following:
char *arr[]={"abc","def"};
qsort((void*)arr[i],strlen(arr[i]),sizeof(char),compare);
For it to work, I have to use it like this:
int len=strlen(arr[i]);
char *buffer=new char[len+1];
strcpy(buffer, arr[i]);        
qsort((void*)buffer,strlen(arr[i]),sizeof(char),compare);
Why is the first method not working when the declaration of qsort() also specifies void* as its first argument? 
I know that in the first method, what I am passing is not an array, but isn't char* always treated as an array?
If not, then what are the cases when it's not treated as an array?
 
     
     
    