I am trying to compare 2 characters with using strcmp. I gave statements but when I enter a and a as two characters, it gives -1. I don't see why? Here is my code:
#include <stdio.h>
#include <string.h>
#define ARR_SIZE 20
int main()
{
//comparing to characters
char c1[1], c2[1];
int result;
//asking user to enter characters respectively
printf("6.Enter the first character you want to compare: \n");
scanf("%s", c1);
getchar();
printf("7.Enter the second character you want to compare: \n");
scanf("%s", c2);
getchar();
//comparing c1 with c2 using strcmp
//result = strcmp(c1, c2);
if (strcmp(c1, c2) == 0)
{
printf("0\n");
}
else if (c1 < c2)
{
printf("-1\n");
}
else
{
printf("1\n");
}
}