scanf(\"%f\", &num);
I have to check if thats a valid float variable and stop executing if it has symbols like @ or !
@
!
Using the %f specifier in scanf won't scan anything else, if no float is specified, nothing will be read. You should check the return value of scanf.
There are a few defined return values:
EOF = -1 invalid input = 0 valid = >0