0
#import <Foundation/Foundation.h>
/* function to generate and return random numbers. */
int * getRandom()
{
static int r[10];
int i;
/* set the seed */
srand((unsigned)time(NULL));
for (i = 0; i < 10; ++i)
{
r[i] = rand();
NSLog(@"%d\n", r[i]);
}
NSLog(@"checking for r value: %d\n", r);
return r;
}
/* main function to call above defined function */
int main()
{
/* a pointer to an int */
int *p;
int i;
p = getRandom();
for (i = 0; i < 10; i++)
{
NSLog(@"*(p + [%d]) : %d\n", i, *(p + i));
}`enter code here`
return 0;
}
请问我需要一个关于objective-c的新东西,关于运行上面的代码(“检查r值:6296000”)成为输出的“NSLog(@”检查r值:%d \ n“,r)”,r变成了6296000,请问6296000的含义是什么?目标C中的指针返回函数的指针
r是一个数组。另请参见[this](https://stackoverflow.com/questions/3959705/arrays-are-pointers)问题。 –