<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>变量作用域 on Blue_Sky蓝天计划</title><link>https://blue-sky.tech/tags/%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/</link><description>Recent content in 变量作用域 on Blue_Sky蓝天计划</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><managingEditor>3465179943@qq.com (Li)</managingEditor><webMaster>3465179943@qq.com (Li)</webMaster><copyright>© 2025 嵌入式开发者博客. 保留所有权利.</copyright><atom:link href="https://blue-sky.tech/tags/%E5%8F%98%E9%87%8F%E4%BD%9C%E7%94%A8%E5%9F%9F/index.xml" rel="self" type="application/rss+xml"/><item><title>P6 函数</title><link>https://blue-sky.tech/notes/c-cpp/c/c%E8%AF%AD%E8%A8%80%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1/p6-%E5%87%BD%E6%95%B0/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><author>3465179943@qq.com (Li)</author><guid>https://blue-sky.tech/notes/c-cpp/c/c%E8%AF%AD%E8%A8%80%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1/p6-%E5%87%BD%E6%95%B0/</guid><description>&lt;h1 class="relative group"&gt;知识点
&lt;div id="知识点" class="anchor"&gt;&lt;/div&gt;
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
&lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e7%9f%a5%e8%af%86%e7%82%b9" aria-label="锚点"&gt;#&lt;/a&gt;
&lt;/span&gt;
&lt;/h1&gt;
&lt;h2 class="relative group"&gt;7.1 函数的基本概念和定义
&lt;div id="71-函数的基本概念和定义" class="anchor"&gt;&lt;/div&gt;
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
&lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#71-%e5%87%bd%e6%95%b0%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5%e5%92%8c%e5%ae%9a%e4%b9%89" aria-label="锚点"&gt;#&lt;/a&gt;
&lt;/span&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;@ 函数基本概念图
&lt;ul&gt;
&lt;li&gt;![[白板/P15 函数基本概念.canvas|P15 函数基本概念]]&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="relative group"&gt;7.1.1 函数的基本概念
&lt;div id="711-函数的基本概念" class="anchor"&gt;&lt;/div&gt;
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
&lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#711-%e5%87%bd%e6%95%b0%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5" aria-label="锚点"&gt;#&lt;/a&gt;
&lt;/span&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;@ &lt;strong&gt;函数&lt;/strong&gt;: 代表一段可以复用的代码，减少重复代码，实现相对独立的功能&lt;/li&gt;
&lt;li&gt;% C 程序结构: 一个主函数（&lt;code&gt;main&lt;/code&gt;）+ 若干个其他函数&lt;/li&gt;
&lt;li&gt;! &lt;code&gt;main&lt;/code&gt; 函数是程序执行的入口，由系统调用，名字固定&lt;/li&gt;
&lt;li&gt;! 函数之间可以互相调用，但&lt;strong&gt;不要调用 &lt;code&gt;main&lt;/code&gt; 函数&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;! 函数不能嵌套定义（不能在函数内部定义另一个函数）&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 class="relative group"&gt;函数分类
&lt;div id="函数分类" class="anchor"&gt;&lt;/div&gt;
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
&lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#%e5%87%bd%e6%95%b0%e5%88%86%e7%b1%bb" aria-label="锚点"&gt;#&lt;/a&gt;
&lt;/span&gt;
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;% &lt;strong&gt;库函数&lt;/strong&gt;: 如 &lt;code&gt;printf&lt;/code&gt;，直接使用，不需要自己定义&lt;/li&gt;
&lt;li&gt;% &lt;strong&gt;自定义函数&lt;/strong&gt;: 开发者自己写的函数&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="relative group"&gt;7.1.2 函数的定义和返回值
&lt;div id="712-函数的定义和返回值" class="anchor"&gt;&lt;/div&gt;
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
&lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#712-%e5%87%bd%e6%95%b0%e7%9a%84%e5%ae%9a%e4%b9%89%e5%92%8c%e8%bf%94%e5%9b%9e%e5%80%bc" aria-label="锚点"&gt;#&lt;/a&gt;
&lt;/span&gt;
&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;[!tip] 函数定义&lt;/p&gt;</description></item></channel></rss>