>>> a = True
>>> b = False
>>> a = true
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'true' is not defined
>>> b = false
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'false' is not defined
>>>
불린 타입으로 True, False 사용이 가능합니다.
단 정확하게 True, False를 입력해야 합니다.
소문자로만 사용할 경우 오류가 출력됩니다
>>> a = 14
>>> b = -3
>>> c = 4.56
>>> a
14
>>> b
-3
>>> c
4.56
>>>
#include <stdio.h>
#include <limits.h>
int main(void)
{
printf("char 자료형 크기는 = %d to %d\n", CHAR_MIN, CHAR_MAX);
printf("\n");
printf("unsigned char 자료형 크기는 = 0 to %u\n", UCHAR_MAX);
printf("\n");
printf("short 자료형 크기는 = %d to %d\n", SHRT_MIN, SHRT_MAX);
printf("\n");
printf("unsigned short 자료형 크기는 = 0 to %u\n", USHRT_MAX);
printf("\n");
printf("int 자료형 크기는 = %d to %d\n", INT_MIN, INT_MAX);
printf("\n");
printf("unsigned int 자료형 크기는 = 0 to %u\n", UINT_MAX);
printf("\n");
printf("long 자료형 크기는 = %ld to %ld\n", LONG_MIN, LONG_MAX);
printf("\n");
printf("unsigned long 자료형 크기는 = 0 to %lu\n", ULONG_MAX);
printf("\n");
printf("long long 자료형 크기는 = %lld to %lld\n", LLONG_MIN, LLONG_MAX);
printf("\n");
printf("unsigned long long 자료형 크기는 = 0 to %llu\n", ULLONG_MAX);
printf("\n");
printf("double 자료형 크기는 = %u \n", DBL_DIG);
printf("\n");
printf("long double 자료형 크기는 =%u \n", LDBL_DIG);
printf("\n");
return 0;
}
Printf() 함수를 사용해서 자료형 크기를 출력하겠습니다.
마지막으로 sizeof() 함수를 사용해서 자료형이 차지하는 byte 크기를 알아보겠습니다.