zoukankan      html  css  js  c++  java
  • 测试

    有一天,你运用了extern、volatile,结构显示conflicting type qualifiers


    myhead.h

          1 #ifndef MYHEAD                                                                                              
          2 #define MYHEAD
          3
          4 extern int a;
          5 extern void show();
          6
          7 #endif

    test.c

          1 #include <stdio.h>                                                                                          
          2 #include "myhead.h"
          3 int a=3;
          4 int main(int argc, char *argv[])
          5 {
          6
          7     show();
          8     printf("%d\n",3);
          9     return 0;
         10 }

    或者:

    myhead.h

          1 #ifndef MYHEAD                                                                                              
          2 #define MYHEAD
          3
          4 externvolatile  int a;
          5 extern void show();
          6
          7 #endif

    test.c

         1 #include <stdio.h>                                                                                          
          2 #include "myhead.h"
          3 volatile int a=3;
          4 int main(int argc, char *argv[])
          5 {
          6
          7     show();
          8     printf("%d\n",3);
          9     return 0;
         10 }


    volatile 必须在两个文件中同时写明。

  • 相关阅读:
    Codeforces Round #605 (Div. 3)E
    Codeforces Round #628 (Div. 2)
    Codeforces Round #627 (Div. 3)
    AC自动机,知识点+hdu模板题
    Tire树,hdu2846,hdu4825
    Educational Codeforces Round 83 (Rated for Div. 2)
    分层最短路
    初入mysql的学习
    赛后总结
    Codeforces Round #625 (Div. 2, based on Technocup 2020 Final Round) D
  • 原文地址:https://www.cnblogs.com/openix/p/2735724.html
Copyright © 2011-2022 走看看