在这里,我需要编写一个从 main 方法调用的函数,其中整数数组作为参数,请举个例子。
在下面的示例中,参数是 int 类型。
注意:请告诉这是不是正确的方法......
#import <Foundation/Foundation.h>
void displayit (int);
int main (int argc, const char * argv[])
{
@autoreleasepool {
int i;
for (i=0; i<5; i++)
{
displayit( i );
}
}
return 0;
}
void displayit (int i)
{
int y = 0;
y += i;
NSLog (@"y + i = %i", y);
}
提前致谢....