Trouble with type signature for function prototype

The function im having problems with takes an array where each element is an array of unsigned chars i.e. octals representing a bitmap of one of 95 ASCII code characters and searches through this two dimensional array looking for a match for a predetermined of array of unsigned chars i.e. the bitmap of a predetermined char. If we find the char the function outputs the index in the two-dimensional array where each elem. is an array of octals ELSE it return -1 i.e. when the char is not found.

I have 2 files, one .cpp, the other .h. There is a function named find_char. See INPUT and OUTPUT on line 48 in .cpp file. The exception im getting is:
font2.cpp:23:45:error: invalid conversion from unsigned char to unsigned char(*)[5], the input type specified for my function prototype corresponding to find_char. If I put just unsigned char it doesn't fix the problem because it's an array parameter i.e. like a call by reference. I've lead myself to believe that the array variable contains a pointer to the first value in the array and so I've made function prototypes that work with a T* i.e. a pointer to type T. Making the function prototype argument unsigned char* i.e. a pointer to unsigned char simply gives me the exception: "invalid conversion from unsigned char to unsigned char*". When I have the argument be 'unsigned char' I get undefined reference to find_char(unsigned char). Can anyone crack this one?

Thanks for helping,

.cpp file:
.h file:

Last edited on
closed account (zb0S216C)
"::find_char( )" has two distinct parameter types. The first one is a pointer to an array of 5 unsigned integers. The second is a pointer to a pointer to an unsigned integer; very different things. Change the function definition so that it corresponds to the prototype:

int find_char( unsigned int( *Array_ )[5] );

int main( )
  unsigned int Array_[5];
  switch( ::find_char( &Array_ ) )
    // ...

int find_char( unsigned int( *Array_ )[5] )
  // ...

Topic archived. No new replies allowed.