TAILIEUCHUNG - the ansi c programming phần 4

K&R giới thiệu các chức năng sau đây: * Kiểu dữ liệu struct * Kiểu dữ liệu long int * Kiểu dữ liệu unsigned int * Toán tử =+ đã được đổi thành +=, và tương tự cho các toán tử khác để tránh gây hiểu nhầm cho bộ phân tích từ vựng của trình dịch C. (Thí dụ: sự giống nhau dể lầm lẫn của hai câu lệnh i =+ 10 và i = +10). | 64 define external variables and functions that are visible only within a single source file. Because external variables are globally accessible they provide an alternative to function arguments and return values for communicating data between functions. Any function may access an external variable by referring to it by name if the name has been declared somehow. If a large number of variables must be shared among functions external variables are more convenient and efficient than long argument lists. As pointed out in Chapter 1 however this reasoning should be applied with some caution for it can have a bad effect on program structure and lead to programs with too many data connections between functions. External variables are also useful because of their greater scope and lifetime. Automatic variables are internal to a function they come into existence when the function is entered and disappear when it is left. External variables on the other hand are permanent so they can retain values from one function invocation to the next. Thus if two functions must share some data yet neither calls the other it is often most convenient if the shared data is kept in external variables rather than being passed in and out via arguments. Let us examine this issue with a larger example. The problem is to write a calculator program that provides the operators - and . Because it is easier to implement the calculator will use reverse Polish notation instead of infix. Reverse Polish notation is used by some pocket calculators and in languages like Forth and Postscript. In reverse Polish notation each operator follows its operands an infix expression like 1-2 4 5 is entered as 1 2 - 4 5 Parentheses are not needed the notation is unambiguous as long as we know how many operands each operator expects. The implementation is simple. Each operand is pushed onto a stack when an operator arrives the proper number of operands two for binary operators is popped the operator is applied to them

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.