cannot use scanf() /atof()

following is my code

char ok[10];
strcpy(ok,"10.2");
sscanf(ok,"%d",&x);
x=atof("4.2");

but neither atof()/ sscanf converts the string to float