"Segmentation error" means that you tried to access memory that you do not have access to.
The first problem is with your main arguments. The main function should be int main(int argc, char *argv[]) , and you should check that argc at least 2 before accessing argv[1] .
In addition, since you pass from float to printf (which, by the way, converts to double when passed to printf ), you must use the %f format specifier. The %s format specifier is for strings ( '\0' -terminated character arrays).
Eric Finn Oct 28 '13 at 17:49 2013-10-28 17:49
source share