#include<stdio.h>
#include<stdlib.h>
int main()
{
char str[] = "12.54";
float n;
n = atof(str);
printf("String value is %s \n",str);
printf("Number is %f \n",n);
return 0;
}
OUTPUT:
String value is 12.54
Number is 12.540000
Let's connect think dots to code ...
#include<stdio.h>
#include<stdlib.h>
int main()
{
char str[] = "12.54";
float n;
n = atof(str);
printf("String value is %s \n",str);
printf("Number is %f \n",n);
return 0;
}
OUTPUT:
String value is 12.54
Number is 12.540000