The parameters aren't your problem, it would be your function declaration. You declare two return types to the function
string unsigned char bitstring(unsigned char val)
The function returns a string...wait no... an unsigned char... you need to define just one return type, e.g. leave out string. what you want to accomplish would be an array of unsigned chars, thus requiring the char to return a pointer to chars.
void bitstring(unsigned char val, unsigned char* array) //write to array
- Note though that returning arrays is a bad practice and generally fails, if you allocate the array in the function and return a reference to it the reference will fail because the array will deconstruct at the end of a function. A better solution would be to pass an array that you want to read into as a parameter to the function, then write to THAT array.