printf( )에서 float형은 double형으로 변환된다??
찬누리
2023.04.01
printf( )에서 float형은 double형으로 변환된다. 라고 책에 있는데 이게 무슨 뜻인가요?
회색은 안 보셔도 됩니다.
--------------------------------------------------
#include stdio.h
#include string.h
#include tchar.h
#include windows.h
#include locale.h
#include ctype.h
#include iso646.h
#include limits.h
#include float.h
INT _tmain( INT argm, TCHAR * argv[] )
{
FLOAT n1 = 3.0f;
DOUBLE n2 = 3.0;
LONG n3 = 2000000000;
LONG n4 = 1234567890;
_wsetlocale( LC_ALL, _T(korean) );
_tprintf( _T(%f %f %ld %ld \n), n1, n2, n3, n4 );
return 0;
}
--------------------------------------------------
printf( ) 함수는 float형을 내부적으로 double로 처리하기 때문에 float형을 위한 포맷 지정자가 따로 필요없다고 하는데 이게 뭔 말인지 잘 모르겠습니다. 그냥 float형을 확장해서 double로 처리하는 건가요???scanf( )랑 대조적이네요.