I found this code , and i m not sure that whether overloading should happen or not.
void print( int (*arr)[6], int size );
void print( int (*arr)[5], int size );
what happens if I pass pointer to an array of 4 elements , to it should come...
any thread will be helpful.
Overloading will happen, and passing the pointer to the array of 4 int
's will not match either function. It's clearer if you write them as the equivalent form:
void print( int arr[][6], int size );
void print( int arr[][5], int size );
An N×4 array can be decayed to a pointer to array of 4 int
's. And it's well known that 2D arrays having different 2nd dimensions are incompatible.
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