typedef struct _LIST_ENTRY {
struct _LIST_ENTRY * Flink;
int a;
struct _LIST_ENTRY * Blink;
} LIST_ENTRY,*PLIST_ENTRY;
EX_ListHead是一个_LIST_ENTRY结构体变量,那么EX_ListHead.Flink和EX_ListHead.Flink->Blink代表什么?
答:EX_ListHead.Flink和代表一个_LIST_ENTRY类型的指针,这个指针站4个字节位于EX_ListHead变量的空间内,
EX_ListHead.Flink->Blink,如果令EX_ListHead.Flink=X, 那么EX_ListHead.Flink->Blink相当于X.Blink
sprintf(pstudent[i].name,"Student%d",i+1);
// stores a cylinder/head/sector based ATA address
typedef struct _CHSAddr {
WORD cylinder;
WORD head;
WORD sector;
} CHSAddr, *PCHSAddr;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// stores a Logical Block Address
typedef DWORD LBAAddr, *PLBAAddr;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
typedef enum { CHS, LBA } CHSLBA ;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// stores a union of LBA and CHS address
typedef struct _Addr {
CHSLBA type;
union {
LBAAddr lba;
CHSAddr chs;
};
} Addr, *PAddr;
///
//调用
Addr startAddr;
startAddr = LBAtoCHS(&g_FlashInfo, startAddr);
///
static Addr LBAtoCHS(FlashInfo *pFlashInfo, Addr lba)
{
if(lba.type == CHS)
return lba;
Addr chs;
DWORD tmp = pFlashInfo->dwNumBlocks * pFlashInfo->wSectorsPerBlock;
chs.type = CHS;
chs.chs.cylinder = (WORD)(lba.lba / tmp);
tmp = lba.lba % tmp;
chs.chs.head = (WORD)(tmp / pFlashInfo->wSectorsPerBlock);
chs.chs.sector = (WORD)((tmp % pFlashInfo->wSectorsPerBlock) + 1);
return chs;
}
///