标签:clu har row 维数 print turn href list 定义
type 数组名[行][列]
全部初始化为0:
char chAry[2][3] = { 0 };
全部初始化为特定值:
char chAry[2][3] = { 0x00, 0x01, 0x02, 0x10, 0x11, 0x12 };
或者区分行:
char chAry[2][3] = {
{ 0x00, 0x01, 0x02, },
{ 0x10, 0x11, 0x12, }
};
略过某行,部分初始化:
char chAry[2][3] = {
{ },
{ 0x10, 0x11, 0x12, }
};
#include <stdio.h>
int main(int argc, char* argv[])
{
char chAry[2][3] = {
{ 0x00, 0x01, 0x02, },
{ 0x10, 0x11, 0x12, }
};
for (size_t nRow = 0; nRow < 2; nRow++)
{
for (size_t nCol = 0; nCol < 3; nCol++)
{
printf(" %02X ", chAry[nRow][nCol]);
}
printf("\r\n");
}
return 0;
}
标签:clu har row 维数 print turn href list 定义
原文地址:https://www.cnblogs.com/shellmad/p/11695580.html