編譯器:DEV-C++

之前都誤以為『 . 』跟『->』是差不多的

但是根據實驗

  • 宣告的是structure,用『 . 』。
  • 宣告的是point structure,用『->』。

下面是範例

typedef struct _EXAMPLE
{
    int         i;
    float      f;
} EXAMPLE, *EXAMPLE_P

EXAMPLE       sA;
EXAMPLE       pA;

pA = (EXAMPLE*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(EXAMPLE) );

sA.i     = 0;
sA.f     = 0.1;

pA->i  = sA.i;
pA->f  = pA.f;

記得!

point structure要規劃一塊記憶體位置給他用!!