I try to use typedef to structure my code better. While using this i came across the problem that i had to use a Function that deals with pointers,
but I want to use my typedeffed Type. Here is my Code:
typedef unsigned char tSha1Hash[20];
fillvalues(unsigned char *wert); // function supplied by the operationg system
void foo(tSha1Hash *outHashValue) {
unsigned char xywerte[3000];
fillValues(xywerte);
// return the values:
for(unsigned int i = 0; i < SHA1_SIZE; i++)
outHashValue[i]=md_value[i];
}
During the Assignment i get the Error:
error: incompatible types in assignment of âunsigned charâ to âunsigned char[20]â
Do i need to use type-casting? I tried some combinations that seemed logical, but none of them worked.
Did you intend to pass a pointer to a Sha1Hash or just a Sha1Hash to your foo() function?
Currently you are passing a pointer. To fix, don't pass a pointer to it.