<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F%2Fvariable_scope</id>
		<title>变量作用域/variable scope - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F%2Fvariable_scope"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/variable_scope&amp;action=history"/>
		<updated>2026-05-02T12:55:11Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/variable_scope&amp;diff=15766&amp;oldid=prev</id>
		<title>2016年5月23日 (一) 02:48 Pppeng</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/variable_scope&amp;diff=15766&amp;oldid=prev"/>
				<updated>2016-05-23T02:48:22Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;zh-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2016年5月23日 (一) 02:48的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;变量的作用域&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;变量的作用域&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(variable scope)&lt;/ins&gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;在Arduino使用的C编程语言的变量，有一个名为 作用域(scope) 的属性 。这一点与类似BASIC的语言形成了对比，在BASIC语言中所有变量都是 全局(global) 变量。&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;在Arduino使用的C编程语言的变量，有一个名为 作用域(scope) 的属性 。这一点与类似BASIC的语言形成了对比，在BASIC语言中所有变量都是 全局(global) 变量。&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pppeng</name></author>	</entry>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/variable_scope&amp;diff=15759&amp;oldid=prev</id>
		<title>2016年5月23日 (一) 02:45 Pppeng</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/variable_scope&amp;diff=15759&amp;oldid=prev"/>
				<updated>2016-05-23T02:45:12Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;zh-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2016年5月23日 (一) 02:45的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l28&quot; &gt;第28行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第28行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[https://www.microduino.cn/wiki/index.php/Arduino_%E8%AF%AD%E6%B3%95%E6%89%8B%E5%86%8C/zh 返回Arduino语法手册]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pppeng</name></author>	</entry>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/variable_scope&amp;diff=15719&amp;oldid=prev</id>
		<title>Pppeng：创建页面，内容为“变量的作用域&lt;br&gt;  在Arduino使用的C编程语言的变量，有一个名为 作用域(scope) 的属性 。这一点与类似BASIC的语言形成了对比，...”</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/variable_scope&amp;diff=15719&amp;oldid=prev"/>
				<updated>2016-05-23T02:17:58Z</updated>
		
		<summary type="html">&lt;p&gt;创建页面，内容为“变量的作用域&amp;lt;br&amp;gt;  在Arduino使用的C编程语言的变量，有一个名为 作用域(scope) 的属性 。这一点与类似BASIC的语言形成了对比，...”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;变量的作用域&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
在Arduino使用的C编程语言的变量，有一个名为 作用域(scope) 的属性 。这一点与类似BASIC的语言形成了对比，在BASIC语言中所有变量都是 全局(global) 变量。&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
在一个程序内的全局变量是可以被所有函数所调用的。局部变量只在声明它们的函数内可见。在Arduino的环境中，任何在函数（例如，setup(),loop()等）外声明的变量，都是全局变量。&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
当程序变得更大更复杂时，局部变量是一个有效确定每个函数只能访问其自己变量的途径。这可以防止，当一个函数无意中修改另一个函数使用的变量的程序错误。&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
有时在一个for循环内声明并初始化一个变量也是很方便的选择。这将创建一个只能从for循环的括号内访问的变量。&amp;lt;br&amp;gt;&lt;br /&gt;
*'''例子'''：&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:green&amp;quot;&amp;gt;&lt;br /&gt;
int gPWMval;  // 任何函数都可以调用此变量&lt;br /&gt;
 &lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  // ...&lt;br /&gt;
}&lt;br /&gt;
 &lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
  int i;    // &amp;quot;i&amp;quot; 只在 &amp;quot;loop&amp;quot; 函数内可用&lt;br /&gt;
  float f;  // &amp;quot;f&amp;quot; 只在 &amp;quot;loop&amp;quot; 函数内可用&lt;br /&gt;
  // ...&lt;br /&gt;
 &lt;br /&gt;
  for (int j = 0; j &amp;lt;100; j++){&lt;br /&gt;
    //变量j只能在循环括号内访问&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pppeng</name></author>	</entry>

	</feed>