to use the atoi function you must include the stdlib.h
#include
int num;
char text[5]= {'1','9','8','2','3'};
num = atoi(text);
------------------------------------------------------
converting string to float
char test[5]={'2','3','4','.','2'};
float number;
number= atof(test);
printf("number value is: %f\n",number);//output is "234.199997"
No comments:
Post a Comment