상세 컨텐츠

본문 제목

unsigned long long int 를 출력 하는 방법

Developer/일상다반사

by cepiloth 2021. 2. 18. 07:26

본문

728x90
반응형

unsigned long long int 를 출력 하는 방법


#include <stdio.h>

int main() {
    unsigned long long int num = 285212672; //FYI: fits in 29 bits
    int normalInt = 5;
    printf("%ul은 %d바이트. int값은 %d.\n", num, sizeof(num), normalInt);
    return 0;
}

 

위와 같은 코드가 있을때 num 은 unsigned long long 형식이다.
간단한 규칙으로 long 에는 l, long long 에는 ll 을 붙이고, unsigned 를 나타내려면 u 를 붙이면 된다.


printf("%llu", 285212672);

 

기타 다른 자료형 출력하는 방법


%d--> for int

%u--> for unsigned int

%ld--> for long int

%lu--> for unsigned long int

%lld--> for long long int

%llu--> for unsigned long long int

 

 

728x90
반응형

'Developer > 일상다반사' 카테고리의 다른 글

4월 독서 스케줄  (0) 2022.03.28
New FACE  (2) 2021.12.11
핼퍼클래스 단상 - Helper Class  (0) 2021.02.18
조건문(if) 범례  (0) 2019.09.09
내안의 독백  (0) 2018.09.09

관련글 더보기

댓글 영역