I’m doing my college’s task. I wrote like this
int debut[10][100];
char ngroup[10][100];
do
{
printf("1. Group name [1..25] : ");
gets (ngroup[0]);
}while (strlen(ngroup[0])< 1 || strlen(ngroup[0])>25);
do
{
printf("2. Year debute [1900-2011] : ");
scanf("%d",&debut[0]);
} while (debut[0] < 1900 || debut[0] > 2011);
I mean, I want to save a lot of group name which can be added by users, and also the year debut. But, when I made the validation of the year debut from 1900 until 2011 it’s not work. Does anyone know the solution?
debut[0]is a pointer to array of 100 ints, and you try to compare it with an integer value.You need something like this: