LoginSignup
1
1

More than 5 years have passed since last update.

iOSメモ - int x = 010について悩む

Last updated at Posted at 2014-07-16
    //プリフィックスとして使うものだった
    int num = 010;//octal 8進数:10 -> 10進数:8
    NSLog(@"%d",num);
    int num2 = 0b10;//binary 2進数:10 -> 10進数:2
    NSLog(@"%d",num2);
    int num3 = 0x10;//hexadecimal 16進数:10 -> 10進数:16
    NSLog(@"%d",num3);
  • 参考文献

Programming with Objective-C: OSNumber
Programming with Objective-C: Values and Collections

  • 余談

どこで使うのか気になる。
OSNumber,NSNumber,NSIntegerとの関係性とかちゃんと把握したいネ。primitive...orz

  • 追記 int num = 090;//error
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1