VC 编译问题

最近在复习C语言,在编程时发现了个问题:

                                                                          #include <stdio.h>
                                                                           typedef struct 
                                                                           {
                                                                                       int last;
                                                                                     int data[100];
                                                                             }SeqList;
                                                                            void main()
                                                                            {
                                                                               SeqList L1,*L=&L1;
                                                                                L->last=-1;
                                                                                 printf("%d",L->last);}

这样是没有问题的,但是若在主函数前添一个printf语句,就有错误了

                                                                                           #include <stdio.h>
                                                                           typedef struct 
                                                                           {
                                                                               int last;
                                                                              int data[100];

                                                                              }SeqList;
                                                                               void main()
                                                                            { printf("测试");
                                                                               SeqList L1,*L=&L1;
                                                                               L->last=-1;
                                                                               printf("%d",L->last);}

百度后发现是标准不同,我用的VC++6.0,用的是C98标准,此标准必须要求定义变量在最开始

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章