⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program9_05.c

📁 C语言入门经典一书的所有代码。书上面的所有代码均在此。希望大家喜欢
💻 C
字号:
/* Program 9.5 Global variables */
#include <stdio.h>

int count = 0;                         /* Declare a global variable   */

/* Function prototypes */
void test1(void);
void test2(void);

int main(void)
{
  int count = 0;                      /* This hides the global count */

  for( ; count < 5; count++)
  {
    test1();
    test2();
  }
  return 0;
}

/* Function test1 using the global variable   */
void test1(void)
{
  printf("\ntest1   count = %d ", ++count);
}

/* Function test2 using a static variable */
void test2(void)
{
  static int count;                   /* This hides the global count */
  printf("\ntest2   count = %d ", ++count);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -