是否有完整的文档(该接口是目前在crt_externs.h)这个功能:
_NSGetArgc和_NSGetArgv
我不能让苹果网站这个功能上的任何文件.
有人可以向我解释在交互式编程语言环境中Vector和Linked List ADT之间的区别.
谢谢.
有人可以在mac计算机上然后在iphone设备上向我解释这个程序的输出.
我创建了一个不含任何东西的普通Foo类,Foo.h:
#import <Foundation/Foundation.h>
@interface Foo : NSObject {
}
@end
Run Code Online (Sandbox Code Playgroud)
和Foo.m:
#import "Foo.h"
@implementation Foo
@end
Run Code Online (Sandbox Code Playgroud)
要在Mac上测试它,我使用这个main.m:
#import "Foo.h"
int main(int argc, const char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Foo *myFoo;
[myFoo description];
printf("%p\n", myFoo);
[myFoo release];
[pool drain];
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这个程序输出:
0x0
Run Code Online (Sandbox Code Playgroud)
但是在iphone上它会直接崩溃.
谢谢.
在下面的代码中我期待另一个输出!:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _cust {
char customerId[10];
char customerPhone[10];
char customerDep[4];
} cust;
int main(int argc, char **argv) {
cust *newCust;
const char testChar[] = "11W35A5CT-012345678-CORP";
newCust = (cust *)malloc(sizeof(struct _cust));
newCust = (cust *)testChar;
printf("CustomerId = %s\n", newCust->customerId);
printf("CustomerPhone = %s\n", newCust->customerPhone);
printf("CustomerDep = %s\n", newCust->customerDep);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出是:
CustomerId = 11W35A5CT-012345678-CORP
CustomerPhone = 012345678-CORP
CustomerDep = CORP
Run Code Online (Sandbox Code Playgroud)
我期待这个输出:
CustomerId = 11W35A5CT-
CustomerPhone = 012345678-
CustomerDep = CORP
Run Code Online (Sandbox Code Playgroud)
有人能解释一下为什么这样吗?谢谢.
编辑:
为了避免混淆我的帖子,我在调试这个程序时在这里添加了gdb跟踪:
(gdb) …Run Code Online (Sandbox Code Playgroud)