#include int main() { const size_t num_lists = 3; float* a[num_lists]; size_t sizes[num_lists] = {6, 6, 6}; for(int k=0; k < 3; k++) { a[k] = (float*)malloc(sizes[k] * sizeof(float)); } // ... } Now consider the array a. Match each expression to the data type of the expression's value:
(float, float*,float**,float*[3])
a
a[2]
a[2][1]
&a[2][1]
&a[2]
*a
Given code to us:
#include
int main()
{
const size_t num_lists = 3;
float *a[num_lists];
size_t sizes[num_lists] = { 6, 6, 6 };
for (int k = 0; k < 3; k++)
{
a[k] = (float*) malloc(sizes[k] *sizeof(float));
}
..
}
Answer:
a is array of float pointers: data type of a is
float**
a[2] is a float pointer, it points to an array of
floats: data type of a[2] is float*
a[2][1] is a float, it is an element in array
pointed by a[2]: data type of a[2][1] is
float
&a[2][1] is the address of float element: data
type of a[2][1] is float*
&a[2] it the address of float pointer: data
type of &a[2] is float**
*a dereferences to a[0], since a[0] is a float
pointer: data type of *a is float*
-----------------------------------------------------------------------------------------------------------------
Please give a thumbs up if you find this answer helpful.
If it doesn't help, please comment before giving a thumbs
down.
Please Do comment if you need any clarification.
I will surely help you.
Thankyou
Get Answers For Free
Most questions answered within 1 hours.