-
[C/C++] long long 데이터 형의 shift 연산 수행공부/C, C++ 2022. 5. 3. 01:22
#include <stdio.h> int main(void) { printf("(int) 1 << 1: %d\n", (1 << 1)); printf("** 형 변환 적용 되지 않았을 때 => (long long) 1 << 1: %lld\n", (1 << 1)); printf("** 형 변환 적용 되었을 때 => (long long) 1 << 1: %lld\n", ((long long)1 << 1)); return 0; }
long long 데이터 형에 shift 연산 수행 시에는 (long long)으로 data type casting 꼭 해주기!
'공부 > C, C++' 카테고리의 다른 글
[C++] vector 객체의 최소값/최대값 찾기 (0) 2022.07.19 [C++] STL - map, set (0) 2022.05.12 [C++] 공백으로 문자열 자르기, for each문 (나중에 포스트 하기) (0) 2022.03.18 [C++] string 공백 포함 입력, 입력 버퍼 비우기 (0) 2022.01.31 [C++] sort( )를 이용한 구조체 정렬 (0) 2022.01.12