조회 수 1151 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

Code:

@import <limits.h>

// ...

NSLog(@"Primitive sizes:");
NSLog(@"The size of a char is: %d.", sizeof(char));
NSLog(@"The size of short is: %d.", sizeof(short));
NSLog(@"The size of int is: %d.", sizeof(int));
NSLog(@"The size of long is: %d.", sizeof(long));
NSLog(@"The size of long long is: %d.", sizeof(long long));
NSLog(@"The size of a unsigned char is: %d.", sizeof(unsigned char));
NSLog(@"The size of unsigned short is: %d.", sizeof(unsigned short));
NSLog(@"The size of unsigned int is: %d.", sizeof(unsigned int));
NSLog(@"The size of unsigned long is: %d.", sizeof(unsigned long));
NSLog(@"The size of unsigned long long is: %d.", sizeof(unsigned long long));
NSLog(@"The size of a float is: %d.", sizeof(float));
NSLog(@"The size of a double is %d.", sizeof(double));
 
NSLog(@"Ranges:");
NSLog(@"CHAR_MIN: %c", CHAR_MIN);
NSLog(@"CHAR_MAX: %c", CHAR_MAX);
NSLog(@"SHRT_MIN: %hi", SHRT_MIN); // signed short int
NSLog(@"SHRT_MAX: %hi", SHRT_MAX);
NSLog(@"INT_MIN: %i", INT_MIN);
NSLog(@"INT_MAX: %i", INT_MAX);
NSLog(@"LONG_MIN: %li", LONG_MIN); // signed long int
NSLog(@"LONG_MAX: %li", LONG_MAX);
NSLog(@"ULONG_MAX: %lu", ULONG_MAX); // unsigned long int
NSLog(@"LLONG_MIN: %lli", LLONG_MIN); // signed long long int
NSLog(@"LLONG_MAX: %lli", LLONG_MAX);
NSLog(@"ULLONG_MAX: %llu", ULLONG_MAX); // unsigned long long int

 

 

Result:


<32 bit process>
Primitive sizes:
The size of a char is: 1.                
The size of short is: 2.                 
The size of int is: 4.                   
The size of long is: 4.                  
The size of long long is: 8.             
The size of a unsigned char is: 1.       
The size of unsigned short is: 2.        
The size of unsigned int is: 4.          
The size of unsigned long is: 4.         
The size of unsigned long long is: 8.    
The size of a float is: 4.               
The size of a double is 8.               
Ranges:                                  
CHAR_MIN:   -128                         
CHAR_MAX:   127                          
SHRT_MIN:   -32768                       
SHRT_MAX:   32767                        
INT_MIN:    -2147483648                  
INT_MAX:    2147483647                   
LONG_MIN:   -2147483648                  
LONG_MAX:   2147483647                   
ULONG_MAX:  4294967295                   
LLONG_MIN:  -9223372036854775808         
LLONG_MAX:  9223372036854775807          
ULLONG_MAX: 18446744073709551615 


<64 bit process>
Primitive sizes:
The size of a char is: 1.
The size of short is: 2.
The size of int is: 4.
The size of long is: 8.
The size of long long is: 8.
The size of a unsigned char is: 1.
The size of unsigned short is: 2.
The size of unsigned int is: 4.
The size of unsigned long is: 8.
The size of unsigned long long is: 8.
The size of a float is: 4.
The size of a double is 8.
Ranges:
CHAR_MIN:   -128
CHAR_MAX:   127
SHRT_MIN:   -32768
SHRT_MAX:   32767
INT_MIN:    -2147483648
INT_MAX:    2147483647
LONG_MIN:   -9223372036854775808
LONG_MAX:   9223372036854775807
ULONG_MAX:  18446744073709551615
LLONG_MIN:  -9223372036854775808
LLONG_MAX:  9223372036854775807
ULLONG_MAX: 18446744073709551615

 

[출처] https://bhaveshdhaduk.wordpress.com/2014/01/25/ios-objective-c-types/

[참고] http://reference.jumpingmonkey.org/programming_languages/objective-c/types.html

?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
697 Develop [ios] 앱의 로컬 js 파일에서 해당 프로젝트의 이미지 불러오기 hooni 2015.02.10 623
696 Develop [ios] 문자열로 함수 실행하기 (eval 함수처럼) hooni 2015.02.10 849
695 Develop [ios] URL 랜딩 속도(OpenURL 10초 정지되는) 이슈 hooni 2015.02.09 847
694 Develop [js] 2048 예쁘게 만들고 있는거.. ㅋㄷ secret hooni 2015.01.30 0
693 Develop [php] XE 스킨에서 특정 도메인 리다이렉션 file hooni 2015.01.28 573
692 Develop [php] XE에서 도메인 별로 광고 다르게 적용하기 file hooni 2015.01.28 612
691 Develop [maven] Mac OS에 메이븐(maven) 설치하기 file hooni 2015.01.21 1104
690 Develop [ios] iOS 앱 아이콘을 만드는 유틸 file hooni 2015.01.03 867
689 Develop [ios] Xcode의 디버그 모드에서 콜스택 file hooni 2015.01.03 997
688 Develop [ios] binary를 C코드로 변환 file hooni 2015.01.03 1525
687 Develop [ios] APNS에 사용할 인증서 만들기 (KeyChain에 있는 인증서 Export) file hooni 2015.01.03 889
686 Develop [ios] iOS앱의 Xcode 빌드 과정 file hooni 2015.01.03 2273
685 Develop [ios] Xcode를 사용해서 Static Library 만들기 (시뮬레이터 + 디바이스) file hooni 2015.01.03 3276
684 Develop [ios] Thread Loop 내에서 UI 업데이트 방법 hooni 2015.01.03 845
683 Develop [ios] UIView 계층구조 hooni 2015.01.03 1122
682 Develop [ios] UIWebView를 이용한 로컬 HTML 파일 표시 file hooni 2015.01.02 1232
Board Pagination Prev 1 ... 8 9 10 11 12 ... 53 Next
/ 53