You can't. There is no such thing as a "void value". void
is the absence of a value. It is true that it looks like you're returning a "thing" here, but you're not.
In C, this is illegal and your program doesn't even compile.
In C++, the code is accepted as an "oddity" of syntax (this is for making templates easier to implement). Your line is effectively the same as return;
.
ok is there any way to get "buf" value from void and i want to store that in "main" .. is it possible ?
Okay, completely different question now.
buf
is a pointer. So, yes, simply return it. Presumably your callback is required to return void*
by some external force?
void* UsartCallback (uchar* buf, uint len)
{
return buf;
}
I suggest you brush up on pointer syntax; your question (if I now understand it correctly; really hard to tell) betrays a lack of understanding of how to work with pointer types.