check wrong input data!

Hi, i'm making a for loop for a mini game which required the user to enter the input number.Let say if the user accidently entered a character instead of integer the whole program will go haywire so is there anyway to check for the error and prompt the user to input the data again?
Here is the simple program...

for(row=0;row<4;row++)
{

printf("Enter Row%d:",row);

for(col=0;col<4;col++)
{
scanf("%d",&num[row][col]);

}
}
You could read in the input as a character string, then have your program parse it's content, determine whether it is properly defined data for your program, and then convert the content to integers and assign it to the appropriate data structure in your program.
Topic archived. No new replies allowed.