It seems like a simple syntax error but I cant seem to figure out why i am getting this error,
error C2664: 'swap' : cannot convert parameter 1 from 'char **__w64 ' to 'char *'
the program is suppose to take these given names (and it has to be in this order) and sort them in alphabetical order. I'm pretty sure my lodgic is correct, but my deadline for this assighnment is approaching and i wanted to make sure. Thanks for the help!
CODE
#include "stdio.h"
#include "math.h"
#include "string.h"
void main ()
{
char name[5][10] = {"Bob", "June", "David", "Lenny", "Daisy"};
char * a;
char * b;
int x, p;
void swap (char*,char*);
a=(*name);
for (a=(*name);a<(*name+4);a=(*name+1))
{
for (b=(*name+1);b<(*name+4);b=(*name+1))
{
x=strcmp(a,b);
if(x>0)
{
swap(&a,&b);
}
}
}
for (p=0;p<5;p++)
{
printf("%s \n",name[p][10]);
}
}
void swap (char *a, char *b)
{
char temp;
temp=*a;
*a=*b;
*b=temp;
}