result in main and result in decode are two different variables.
If you want decode to know about the result from main you should pass it as a parameter:
void decode(unsigned char* msg, int result[5])
{
// Remove declaration of result
// Keep the rest of the code
}
int main()
{
/* other code */
decode (rxbuf, result); // calling decode funtion
/* other code */
}
solved How to insert for loop in void function?