So my program needs to consist of it forcing the user to input a string between 5-10 characters, with validation, so ensuring that the length is correct, i have this so far but completely stuck, any advice on how to validate the data type to only strings allowed to be inputted?
char x[10];
int length, i;
for(i=0;i=10;i=i+1){
printf("Please enter 5-10 Characters\n");
scanf("%s", &x);
length = strlen(x);
if (length < 5){
printf("Not Long Enough!\n");
}
if (length > 10){
printf("Too Long!\n");
}
while('x' == 'char'){
if (scanf("%s", &x) == 1){
return 0;
}else{
printf("Not a string, Try again");
gets(x);
}
}
printf("You inputted: %s\n", x);
}