C Programming for Scientists & Engineers phần 4

Tất cả các nhà khai thác xác định trong danh sách trên, trừ trường hợp cuối cùng, đã được giới thiệu trong chương 1. Tuy nhiên, một số ví dụ được đưa ra dưới đây để củng cố hành động của họ. Thứ nhất, nhận dạng [.] có thể được gọi là 'yếu tố điều hành được sử dụng để xác định một yếu tố đặc biệt của một mảng | Introduction to executable statements 39 Tutorial Implement lYogram and make brief notes on its operation. Run the program with various input values to give all possible outputs. Tutorial Modify Program so that variables A and li are of type double. Run the program with various input values to give all possible outputs. Identifying operators Four operators are frequently used in c programs to identify things identifies an element of an array . fully qualifies a member of a data structure - provides indirect access to members in a data structure whose address is stored in a pointer identifies the precedence of operations also see Section All of the identifying operators in the above list except for the last have already been introduced in Chapter 1. However several examples are given below to reinforce their actions. Firstly the . identifier could be called the element operator which is used to identify a particular element of an array as in int A B 3 A B 2 assigns the value of the third element of array B to A Secondly the dot operator . is used with the name of a data structure to access its member variables as in struct PAIR intA double B Declares a template for a data structure data type called struct PAIR 40 c programming for scientists and engineers struct PAIR PAIR-1 PAIR-2 intA 2 B 9 Declares two structures of type struct PAIR. Declares and initializes A and B. 5 Assigns the value 5 to A in PAIR-1. 5 Assigns the value 5 to B in PAIR-1. PAIR-2. A 10 Assigns the value 10 to A in PAIR-2. 5 Assigns the value 5 to B in PAIR-2. A Assigns the value 2 to B in PAIR-1. B PAIR-1. A Assigns the value 5 to B. Assigns the value 10 to B in PAIR-1. PAIR- PAIR-2. A A Assigns the value 30 to B In PAIR-2. In the above example there are three variables calledT and another three called B. In addition to the declaration int A 2 B 9 two structures PAIR and PAIR-2 are declared each containing

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.