I am trying to validate the input of the array to only allow an input of only one single digit integer (either 2 or 3) at each index of the array. For example a = [2,3,2,3,2,2,2,2,2,3]. My attempt is below.
int main()
{
int a[10];
int b;
bool c= false;
printf( "Please the 10 values: \n");
while(c)
{
for(b=0;b<10;b++)
{
scanf("%d", &a[b]);//enter each value individually
if(&a[b]==2 || &a[b]==3)
{
c= true;
}
else
{
printf("please the value");
scanf("%d", &a[b]);
c= false;
}
}
}
}