#include < stdio.h > // A forum bug, remove the spaces around stdio.h
float (*ptr_to_float_array_size_3)[3];
float my_float_array[] = { 10.0, 11.0, 12.0 };
void print_index_2(float *arg_array){
// This is probably what you want
printf("arg_array[2] = %f\n", arg_array[2]);
}
void stupid_function(float (*arg_ptr_to_float_array_size_3)[3]){
// This is probably not what you want
printf("Element at index 2 in the array = %f\n", (*arg_ptr_to_float_array_size_3)[2]);
printf("Can also be accessed like this = %f\n", arg_ptr_to_float_array_size_3[0][2]); // Array with index zero, value at index 2 in that array
}
int main(int argc, char *argv[]){
// An array name is a pointer to the first element
print_index_2(my_float_array);
// If you take the address of an array, you get a pointer to the whole array
ptr_to_float_array_size_3 = &my_float_array;
stupid_function(ptr_to_float_array_size_3);
printf("An array name is a pointer to the first element, size = %lu\n", sizeof(*my_float_array));
printf("The address of an array is a pointer to the whole array, size = %lu\n", sizeof(*(&my_float_array)));
return(0);
}