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 必须在两个文件中同时写明。

  • 相关阅读:
    C#中Equals和= =(等于号)的比较)(转载)
    C# 控制台应用程序输出颜色字体
    c#获取当前运行程序所在的目录
    java环境配置
    c#随机产生颜色
    Git学习
    git删除所有提交历史记录
    git忽略项gitegnore配置
    不搭建git服务器对git仓库进行局域网内共享多人合作开发项目
    搭建Git服务器-SCM-Manager
  • 原文地址:https://www.cnblogs.com/openix/p/2735724.html
Copyright © 2011-2022 走看看