2
void GetKey(int date, unsigned char[] key)
{

}

I am trying to pass unsigned char array t a function but I get an error "expected a ')'" where "key" variable is.

2 Answers 2

6

Just move the brackets:

void GetKey(int date, unsigned char key[])

But note that it'll essentially degenerate into a pointer.

Sign up to request clarification or add additional context in comments.

Comments

2

Use template function:

template<size_t N>
void GetKey(int date, unsigned char(&key)[N])
{
}

1 Comment

What actually happens when you write a template like that, using size_t instead of class or typename? And then, what would unsigned char(&key)[N] actually be? Sorry if these are stupid questions. I'm trying to rebuild my C++ knowledge ground-up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.