본문 바로가기

C_C++

그 외의 변환 함수 : atoi, atol, atof








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

int main(void)
{
char str[20];
printf("정수 입력 : ");
scanf("%s", str);
printf("%d \n", atoi(str));
printf("실수 입력 : ");
scanf("%s", str);
printf("%g \n", atof(str));
return 0;
}