つい %c とするものかと思ったのですが。
NSString *str;
str = [[NSString alloc] initWithFormat:@"%d/%d/%02d", 2010, 12, 21];
NSLog(@"date format: %@", str); //NSStringをフォーマット出力する際は %@ を利用。オブジェクトそのものを出力
//NSLog(str);
NSString *str;
str = [[NSString alloc] initWithFormat:@"%d/%d/%02d", 2010, 12, 21];
NSLog(@"date format: %@", str); //NSStringをフォーマット出力する際は %@ を利用。オブジェクトそのものを出力
//NSLog(str);
#importint main (int argc, const char * argv[]) { int abc = 3; { int abc = 2; NSLog(@"%d", abc); // 2 } NSLog(@"%d", abc); // 3 return 0; }
$ nohup ./example.sh
<pre class="prettyprint"> (コード) </pre>
| 型 | 32bit環境 | 64bit環境 |
|---|---|---|
| short | 16 | 16 |
| int | 32 | 32 |
| long | 32 | 64 |
#import <Foundation/Foundation.h>
//マクロ定義
#define TEST 18 //プリプロセッサへの命令なので;(セミコロン)が必要ない。セミコロンを付けるとそれも展開される
int main (int argc, const char * argv[]) {
double test = 99; //ステートメント
NSLog(@"test : %d", test); //ステートメント
NSLog(@"TEST : %d", TEST); //ステートメント
return 0;
}
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
int num1 = 14;
int num2 = 4;
NSLog(@"num1 + num2 = %d", num1 + num2);
NSLog(@"num1 - num2 = %d", num1 - num2);
NSLog(@"num1 * num2 = %d", num1 * num2);
NSLog(@"num1 / num2 = %d", num1 / num2);
NSLog(@"num1 %% num2 = %d", num1 % num2);
return 0;
}
@"hoge"
$ open -h NSString
$ open hoge.txt
#import <Foundation/Foundation.h> #import <AppKit/AppKit.h> #import <CoreData/CoreData.h>