Using the standard library functions .

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
char str1[10] = "123.456", str2[10] = "12345", str3[10];
float f;
int i;

f = atof(str1); // converts string to float
i = atoi(str2); // converts string to int

printf("\nFloating point value : %f", f);
printf("\nInteger value : %d", i);

itoa(i,str3,10);// converts int to string

printf("\nString value : %s", str3);
getch();
return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin