Hello

Any one know how to limit the character input
by user if I use gets()?

My program works, it suppose to compare two
line enter by user and see if they are the same, but I think I need a loop some where
to tell the user they enter to many characters
if they enter more then 25 characters. The following is my code, can someone please take it look and give me some suggestions, thank you.

#include <stdio.h>
#include <stdlib.h>

int compare(char *, char *); /* Function prototype for compare two lines */

int main(void)

{
char array_1[26];
char array_2[26];

/* Have user enter two line */
printf("\nPlease enter two lines, with maximum of 25 characters per line\n") ;

gets(array_1); /* store the first line enter by user to array_1 */
gets(array_2); /* store the second line enter by user to array_2 */

/* Call function to compare the two array, and output the the results
of lines are equal or not equal to screen */

if(compare(array_1, array_2))
printf("\nThe two line are equal\n");
else
printf("\nThe two line are not equal\n");

return;
}

/* Function definition of compareing two line (arrays) */
int compare(char *array_1, char *array_2)

{
int value;

/* Use while loop to compare one character at a time from two arrays */
while (*array_1 == *array_2 && *array_1 != '\0')

{
++array_1;
++array_2;
}

if(*array_1 == *array_2)
value = TRUE;
else
value = FALSE;

return (value); /* return the value to the main */
}