1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Chap6 slides

55 1 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 55
Dung lượng 201,01 KB

Nội dung

Chap6 slides [Compatibility Mode] Programming Fundamentals 1 Chapter 6 FUNCTIONS AND POINTERS Programming Fundamentals 2 Chapter 1 § Function and parameter declarations § Returning values § Variable s[.]

Chapter FUNCTIONS AND POINTERS Programming Fundamentals Chapter § § § § § § § § § Function and parameter declarations Returning values Variable scope Variabe storage classes Pass-by-reference Recursion Passing arrays to functions Pointers The typedef declaration statement Programming Fundamentals Function and parameter declarations n User-defined program units are called subprograms In C++ all subprograms are referred to as functions n Defining a Function The lines that compose a function within a C++ program are called a function definition The syntax for defining a function: data_type name_of_function (parameters){ statements; } Programming Fundamentals n A function definition consists of four parts: • A reserved word indicating the data type of the function’s return value • The function name • Any parameters required by the function, contained within ( and ) • The function’s statements enclosed in curly braces { } n Example 1: void FindMax(int x, int y){ int maxnum; if ( x > = y) maxnum = x; else maxnum = y; cout b >> c; cout side; cout

Ngày đăng: 11/04/2023, 16:03

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN