Hi I would like to allow scanf to scan only numbers from 0 to 7 all the other numbers should give out a print message like error or similar. It doesn't seem to work. Can anyone give me an advice, I would like to do it as simple as possible as my experience in c is almost non existent.
This is how I want to start but it seems not to work properly, what am I doing wrong?
insert
Code:
main ()
{ int x;
printf("Input a number from 0 to 7\n");
scanf("%[0-7]o", &x);
printf("The number is x=%o", x);
return 0;
}