70 likes | 226 Views
프로그래밍 C 언어. C 의 자료형. C 의 자료형. #include <stdio.h> int main() { short books, weight; short total; weight = 30; books = 1500; total = books * weight; printf(" 책 1500 권의 무게는 %d 이다 .<br>",total); return 0; }. C 의 자료형. sizeof 연산자 - 단항 연산자 - 할당된 메모리 크기. C 의 자료형. int main()
E N D
C의 자료형 #include <stdio.h> int main() { short books, weight; short total; weight = 30; books = 1500; total = books * weight; printf("책 1500권의 무게는 %d이다.\n",total); return 0; }
C의 자료형 sizeof 연산자 - 단항 연산자 - 할당된 메모리 크기
C의 자료형 int main() { printf("char : %d byte\n",sizeof(char)); printf("short : %d byte\n",sizeof(short)); printf("int : %d byte\n",sizeof(int)); printf("long : %d byte\n",sizeof(long)); printf("float : %d byte\n",sizeof(float)); printf("double : %d byte\n",sizeof(double)) return 0; }
C의 자료형 int main() { float f; double d; f = 12345670.12; d = 12345670.12; printf("%f\n",f); printf("%f\n",d); return 0; }