■ソースコード
#include <stdio.h>
struct mystruct{
int a;
int b;
int c;
int d;
int e;
int f;
int g;
};
int main(void){
struct mystruct s;
struct mystruct *p;
p = &s;
printf("%d\n",p->a);
printf("%d\n",p->b);
printf("%d\n",p->c);
printf("%d\n",p->d);
printf("%d\n",p->e);
printf("%d\n",p->f);
printf("%d\n",p->g);
}
■コンパイル(ポインタを介してデータにアクセスしているとコンパイラの警告が出ない)
>cl helloauto3.c
Microsoft(R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
helloauto3.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:helloauto3.exe
helloauto3.obj
■実行結果
>helloauto3.exe
1245104
4203648
-874184279
-2
4215639
4215659
0