c++,objective-c是由c语言发展起来的。objective-c有20年的历史,开发苹果的程序需要掌握objective-c、XCode、mac OC等。
第一个程序,hello XCode:
#include <stdio.h>
int main (int argc, const char * argv[]) {
int a=0;
for (int i=1; i<101; i++) {
a=a+i;
}
printf("total=%d, ok\n",a);
return 0;
}
错误的 printf("total=%n, ok\n",&a);
正确的 printf("total=%d, ok\n",a);