tailieunhanh - c for engineers and scientists introduction to programming with ansi c phần 6

Viết một chương trình để hiển thị sau đây nhắc nhở: Nhập một tháng (sử dụng 1 cho Jan, vv): Nhập một ngày tháng: chương trình của bạn chấp nhận và lưu trữ một số trong tháng biến phản ứng với dấu nhắc đầu tiên, và chấp nhận và lưu trữ một số trong NGÀY biến phản ứng với dấu nhắc thứ hai. Nếu | 318 Chapter Seven Writing Your Own Functions variable name only affects the local variable s contents. Thus the value of the global variable can never be altered by the function. Another common error is omitting the called function s prototype within the calling function. The called function must be alerted to the type of value that will be returned and this information is provided by the function prototype. This declaration can only be omitted if the called function is physically placed in a program before its calling function or the called function returns an integer or void data type. The actual value returned by a function can be verified by displaying it both before and after it is returned. The last two common errors are terminating a function s header line with a semicolon and forgetting to include the data type of a function s parameters. Chapter Summary 1. A function is called by giving its name and passing any data to it in the parentheses following the name. If a variable is one of the arguments in a function call the called function receives a copy of the variable s value. 2. The commonly used form of a user-written function is return-type function-declarator declarations other statements The first line of the function is called the function header. The opening and closing braces of the function and all statements between these braces constitute the function s body. The storage class of the function specified in the header is optional and can be either static or extern. If no storage class is specified it defaults to extern. The returned data type is by default an integer when no returned data type is specified. The function declarator must be included for each function and is of the form function-name parameter list The parameter list must include the names of all parameters and their data types. 3. A function s return-type is the data type of the value returned by the function. If no type is declared the function is assumed to return an integer .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
31    248    0    26-04-2024
10    116    0    26-04-2024
173    103    0    26-04-2024
40    97    0    26-04-2024
11    150    1    26-04-2024
11    110    0    26-04-2024
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.