For completeness based on valuable inputs from @Jonathan Leffler and @Jens, I drop my proven answer.
Here is the function I've tested and started to use;
#include <stdio.h>
const unsigned char * MAC_HEX_TO_STR(char *MAC_ADDR);
const unsigned char * MAC_HEX_TO_STR(char *MAC_ADDR){
// If static is not used, due to local variable is destroyed out of the function will return gibberish!
static char memory[13];
static char *MAC_ADDR_NEW = memory;
snprintf(memory, sizeof(memory), "%.2X%.2X%.2X%.2X%.2X%.2X", (unsigned char)MAC_ADDR[0], (unsigned char)MAC_ADDR[1], (unsigned char)MAC_ADDR[2], (unsigned char)MAC_ADDR[3], (unsigned char)MAC_ADDR[4], (unsigned char)MAC_ADDR[5]);
//printf(" 1 ==>> %s\n ", MAC_ADDR_NEW); // Debug if you like
//MAC_ADDR_NEW[13] = 0; // I don't know, I tried with or without but no difference observed!
return MAC_ADDR_NEW;
}
int main()
{
char *MAC_ADDR = "\x00\x22\xC7\xFF\xFF\x27";
const unsigned char* RETURNED_MAC = MAC_HEX_TO_STR(MAC_ADDR);
printf(" RETURNED_MAC ==>> %s\n ", RETURNED_MAC );
return 0;
}
You may reach the test from here.