先看一段代码:
1 /********************************************************************* 2 * @fn bdAddr2Str 3 * 4 * @brief Convert Bluetooth address to string. Only needed when 5 * LCD display is used. 6 * 7 * @return none 8 */ 9 char *bdAddr2Str( uint8_t *pAddr )//ownMacAdd[6] 10 { 11 #define B_ADDR_STR_LEN 15 12 13 uint8_t i; 14 char hex[] = "0123456789ABCDEF"; 15 static char str[B_ADDR_STR_LEN]; 16 char *pStr = str; 17 18 *pStr++ = ‘0‘; 19 *pStr++ = ‘x‘; 20 21 // Start from end of addr 22 pAddr += B_ADDR_LEN; 23 24 for ( i = B_ADDR_LEN; i > 0; i-- ) 25 { 26 *pStr++ = hex[*--pAddr >> 4]; 27 *pStr++ = hex[*pAddr & 0x0F]; 28 } 29 30 *pStr = 0; 31 32 return str; 33 }
看到这段代码,我首先就想到了优先级。经过测试得出优先级为:
*优先级大于 --、++的优先级。
时间: 2024-10-05 23:58:30