- 4
- 0
- 约1.41万字
- 约 15页
- 2018-06-10 发布于江西
- 举报
c函数、数组、指针和调试器gdb--函数(C functions, arrays, pointers, and debugger gdb-- functions).doc
c函数、数组、指针和调试器gdb--函数(C functions, arrays, pointers, and debugger gdb-- functions)
Definition of function
1, the general form of function (function) is defined as:
Returns the type function name (list of formal arguments)
{
Function body
}
In the C language, functions are uniquely identified by function names. A function name is an identifier that does not have the same name as other functions. Otherwise, when the function calls, the system does not know which one to call. But as in the extension of the C + + language for the C language, function allows the same.
The return type of a function is the type that returns the value when calling the function, and can be any basic data type or pointer. When the function does not return any value, it should be defined that the return type of the function is void. If you do not specify a return type when defining a function, the most commonly used compiler Linux on GCC is the default return type of int.
A formal parameter is the operand of a function, separated by commas.
The part of a function that performs an operation is called a function body. You can define variables in the body of the function, manipulate the formal parameters, and return the data. The following definition of a function, used to find the larger of the two numbers, the code is as follows:
Int max (int, a, int, b)
{
Int c;
C = ab? A:b;
Return c;
}
In the first line, the first keyword, int, indicates the return type of this function is integer. Max is the function name, and there are two formal arguments in parentheses. They are all integer, and the parameters are separated by commas. The first line in the function body defines an integer variable C, and the second line will assign the larger value in a and B to C. The last line of the function body returns the value of the variable C to the caller by using the return statement. Here we notice that the type of the variable C is consistent with the return type of the function, both of which are of type int.
您可能关注的文档
- 届高考数学一轮复习第章函数导数及其应用第讲函数的奇偶性与周期性学案.doc
- 2018届宁夏银川九中高三下学期第二次模拟考试文科综合试题及答案.doc
- 二维传染病模型..doc
- 高考英语词汇词带音标.docx
- 九型人格-题版.doc
- C语言实验六指针.doc
- 外资进入对广东产业结构演进的影响——基于面板数据模型的研究.doc
- c数组、指针与字符串xiti答案.doc
- SYZX型绳索取心液动锤在肃北德勒诺尔铁矿区的应用.doc
- 2017-2018学年高中数学 第一章 导数及其应用 1.3 导数在研究函数中的应用 1.3.2 函数的极值与导数教学案 新人教A版选修2-2.doc
- 安徽省华师联盟2025-2026学年高三上学期1月质量检测生物试卷+答案.doc
- 安徽省华师联盟2025-2026学年高三上学期1月质量检测语文试卷+答案.doc
- 四川省绵阳南山中学实验学校2025-2026学年高三上学期1月月考数学含答案.doc
- 2026届辽宁省大连市高三上学期双基考试物理试卷+答案.doc
- 辽宁名校联盟2026年1月高三上期末联考质量检测化学含答案.doc
- 辽宁名校联盟2026年1月高三上期末联考质量检测生物含答案.doc
- 辽宁名校联盟2026年1月高三上期末联考质量检测英语含答案.doc
- 辽宁名校联盟2026年1月高三上期末联考质量检测政治含答案.doc
- 黑龙江省龙江教育联盟2026年1月高三上学期期末考试化学含答案.doc
- 黑龙江省龙江教育联盟2026年1月高三上学期期末考试生物含答案.doc
原创力文档

文档评论(0)