I am working on a similar program and am getting an error that states 'strcmp' cannot convert parameter 1 from 'const char' to 'const char *'. ( I haven't gotten to the swap yet.) Do you know how I should fix this?
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define MAXLINE 100
#define N_STRINGS 7
char *change(const char *s);
int main(void)
{
char line[MAXLINE];
char line2[MAXLINE];
const char *s = line;
const char *p = line2;
int k;
int i;
int j;
printf("Enter 7 strings to be sorted.\n\n");
scanf(" %[ a-zA-Z]", line);
printf("\n\nThe following %d strings will be sorted: \n\n", N_STRINGS);
printf("%s\n", change(line));
printf("\nThe sorted list is displayed below: \n\n");
strcpy(line2, line);
for (k = 0; k < 1; k++)
printf("%s\n", change(line2));
for (j = 0; j < N_STRINGS; j++)
{
for (i = i + 1; i < N_STRINGS; i++)
{
if ((strcmp(p[j], p[i])) > 0)
printf("yes");
}
}
return 0;
}