How can I initialize pointer to an array in C correctly
Here is my code
int (*data[10]);
int a[10];
data = &a[0]; /* gives a warning "int *" cannot be assigned to entity of "int (*)[10]" */
How can I get rid of this warning?
Declare a pointer to an array correctly:
int (*data)[10];
Assign a pointer to an array to it:
int a[10];
data = &a;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With