scanf(\"%f\", &num);
I have to check if thats a valid float variable and stop executing if it has symbols like @ or !
@
!
Check the return value from scanf(). It will return the number of successfully scanned inputs - in your case it should be 1. If it is not equal to one, it could be -1 which means "end of file" or 0, which means "input wasn't valid".
scanf()
1