Untitled
unknown
plain_text
4 years ago
544 B
8
Indexable
#include <stdio.h>
#include <stdlib.h>
int main()
{
char buffer[256];
printf("Enter: ");
fgets(buffer, 256, stdin);
float n1 = atof(buffer);
printf("Using atof: %f\n", n1);
int n2 = atoi(buffer);
printf("Using atoi: %d\n", n2);
long n3 = atol(buffer);
printf("Using atol: %ld\n", n3);
double n4 = strtod(buffer, NULL);
printf("Using strtod: %f\n", n4);
double n5= strtol(buffer, NULL,0);
printf("Using strtol: %f\n", n5);
double n6 = strtoul(buffer, NULL, 0);
printf("Using strtoul: %f\n", n6);
return 0;
}Editor is loading...