how can convert ?
I want to convert float array1[80] to const float * array2, How can I?
Implicitly.
1 2
|
float array1[80];
float const* array2 = array1;
|
Note that
array2 is not an array. Rather, it is the address of the first element of
array1.
If you just want to pass it to a function that accepts const float *, just pass it:
1 2 3 4 5 6 7 8 9 10
|
void func(const float *a, int size)
{
}
int main()
{
float a[80];
func(a, 80); // note that you usually pass a size, too
}
|
Topic archived. No new replies allowed.