TAILIEUCHUNG - Computer Programming for Teens phần 9

Hãy nhớ rằng máy tính sẽ biết chức năng để sử dụng nó sẽ sử dụng một trong đó tương ứng với các kiểu dữ liệu phù hợp với nó. Xem Hình . các Phân loại có nghĩa là sắp xếp dữ liệu theo thứ tự. Sắp xếp một danh sách các tên theo thứ tự chữ cái là một ví dụ về phân loại. | The Pointer Variable A Dynamic Variable 261 Answer Result Name Dorothy Figure Three static variables are shown with their values inside. Pointer variables unlike static variables do not contain values. They contain addresses that look like a combination of letters and numbers. See Figure . p A114 s CD2F m B009 Figure Three pointer variables are shown with addresses inside of them. Since pointer variables contain addresses where data is stored programmers can make use of them in functions. Functions as you may recall often have parameters that are sent into the function to be manipulated. Some of these parameters are called variable or reference parameters see Chapter 8 . Reference parameters are really pointer variables because they allow you to refer to another location where contents are stored. Normally when a variable is needed in a function it needs to have all of its contents copied into a new memory spot for the function. A pointer variable just passes its address to the function so that the function can get at its contents without having to copy its contents. Programming with pointer variables allows programmers to conserve memory. Imagine four separate functions that all alter the same variable called checkamount. If static variables are used each function must have copies of that variable and will use memory to make those copies. If pointer variables are used instead each function can simply store the address of checkamount. This saves a lot of memory space. 262 Chapter 17 Pointers Who Is Looking at Whom How a Pointer Variable Works Now that you know that pointers contain addresses the question is How do they work The first step is to get the address that is contained in the pointer. The next step is to go to that address where another variable is found . Then you can go inside of the other variable to get its value. Because the pointer contains an address it really points to another place in memory. At that other place in memory

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.