실수형 문자를 실수형 변수에 어떻게 넣나요?

하하의 이미지

char x[20];

double y;

memset(x, 0x0, 20);

strcpy(x, "234.789");

y <=== x 를 넣으려고 합니다.

atoi, atoll 같은 류의 함수가 있나요?

doldori의 이미지

double y = atof("234.789");

chadr의 이미지

atof 라는 함수가 있긴 합니다만 strtod 함수의 사용을 권해드립니다.

-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.