Hi all!
Well im kinda noobish at the c-programming language, not a full blown reatard tho. Lets say that i wanna write a simple program that wants to calculate the value of x in function:
y = kx + m
We want the user to enter the value of y, k and m and doing this by:
float y, k, m;
printf("Enter value for K: ");
scanf("%f", &k);
(i just stop here, dont need to write more code)
Here is my problem....... when i run the program and the user types the a char instead of an int my program crasch. How can i prevent this? Is there any test for keypress or something else i can do?
Ty.