tailieunhanh - Kỹ thuật lập trình_Module 5

Tham khảo tài liệu 'kỹ thuật lập trình_module 5', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Module 5 Introducing Functions Table of Contents CRITICAL SKILL Know the general form of a CRITICAL SKILL Creating a CRITICAL SKILL Using CRITICAL SKILL Using CRITICAL SKILL Using Functions in CRITICAL SKILL Local CRITICAL SKILL Global CRITICAL SKILL Passing Pointers and Arrays to CRITICAL SKILL Returning CRITICAL SKILL Pass Command-Line Arguments to main .26 CRITICAL SKILL Function CRITICAL SKILL This module begins an in-depth discussion of the function. Functions are the building blocks of C and a firm understanding of them is fundamental to becoming a successful C programmer. Here you will learn how to create a function. You will also learn about passing arguments returning values local and global variables function prototypes and recursion. Function Fundamentals A function is a subroutine that contains one or more C statements and performs a specific task. Every program that you have written so far has used one function main . They are called the building blocks of C because a program is a collection of functions. All of the action statements of a program are found within functions. Thus a function contains the statements that you typically think of as being the executable part of a program. Although very simple programs such as many of those shown in this book will have only a main function most programs will contain several functions. In fact a large commercial program will define hundreds of functions. 1 C A Beginner s Guide by Herbert Schildt CRITICAL SKILL Know the general form of a function All C functions share a common form which is shown here return-type name parameter-list body of function Here return-type specifies the type of data returned by the function. This can be any valid type except an array. If the function does not return a value its return type must be void. .

TỪ KHÓA LIÊN QUAN