Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective-C中向量_float2*的C数组_Objective C - Fatal编程技术网

Objective-C中向量_float2*的C数组

Objective-C中向量_float2*的C数组,objective-c,Objective C,如何生成“vector_float2*”的C数组?你能给我举个例子吗?你需要知道的一切: // simple C array: type identifier[] = {value,value,...}; // example: int myIntegers[] = {1,2,3}; // Note that specifying the size is optional. // example of a vector_float2 value: vector_float2 m

如何生成“vector_float2*”的C数组?你能给我举个例子吗?

你需要知道的一切:

// simple C array: type identifier[] = {value,value,...};
// example:        int  myIntegers[] = {1,2,3};
// Note that specifying the size is optional.

// example of a vector_float2 value: vector_float2 myVector = {1.0,1.0};

// array of 9 (3x3) vector_float2 values:
vector_float2 myVectors[] = {
    {0.0,0.0},{0.5,0.0},{1.0,0.0},
    {0.0,0.5},{0.5,0.5},{1.0,0.5},
    {0.0,1.0},{0.5,1.0},{1.0,1.0}
};

// Note that  vector_float2 *  and  vector_float2 []  are interchangeable:
vector_float2 * vectors = myVectors

vector_float2 aVector = vectors[4];
printf("vector x:%f y:%f\n",aVector.x,aVector.y);
您需要知道的是:

// simple C array: type identifier[] = {value,value,...};
// example:        int  myIntegers[] = {1,2,3};
// Note that specifying the size is optional.

// example of a vector_float2 value: vector_float2 myVector = {1.0,1.0};

// array of 9 (3x3) vector_float2 values:
vector_float2 myVectors[] = {
    {0.0,0.0},{0.5,0.0},{1.0,0.0},
    {0.0,0.5},{0.5,0.5},{1.0,0.5},
    {0.0,1.0},{0.5,1.0},{1.0,1.0}
};

// Note that  vector_float2 *  and  vector_float2 []  are interchangeable:
vector_float2 * vectors = myVectors

vector_float2 aVector = vectors[4];
printf("vector x:%f y:%f\n",aVector.x,aVector.y);

Objective-C是C的超集。如果你能在C中创建数组,你知道如何在Objective-C中创建,因为它是相同的。Objective-C是C的超集。如果你能在C中创建数组,你知道如何在Objective-C中创建,因为它是相同的。