This is what I have. The program builds successfully from my original to everybody else's way. When u run the program it tells u to enet the first string then enter the second string. The problem is right after u press enter after u have entered the second string it says the first string is larger everytime and not onlyy that but it also prints it out infinte amout of times as in it keeps on running and it never stops. The only way u can stop it is if u exit out of it.
Code:
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define MAX 100
int main() {
char s1[MAX] = {0};
char s2[MAX] = {0};
int x;
printf("Input first string:\n");
fgets (s1 , MAX , stdin);
printf("Input second string:\n");
fgets (s2 , MAX , stdin);
x = strcmp(s1, s2);
if (x == 0)
printf("These strings are equal\n");
else if (x > 0)
printf("The first string is larger\n");
else
printf("The second string is larger\n");
return 0;
}