TAILIEUCHUNG - Lecture note Data visualization - Chapter 8

This chapter presents the following content: Data structures and problems with C, pointers, arrays and structures, types of arrays, use of vectors. | Lecture 08 Recap Data Structures and Problems with C Pointers Arrays and Structures Types of Arrays Use of Vectors Resizing the Vector One limitation of primitive arrays is that, once they have been declared, their size can never change However, we can use resize to change the size of a vector Pointers are used to give the illusion of an array that can be resized Example arr is representing a 10-element vector Somewhere, buried in the implementation then, memory is allocated for 10 elements Suppose that we would like to expand this memory to 12 elements The problem is that array elements must be stored in contiguous memory and that the memory immediately following arr might already be taken Continued . Do the following We remember where the memory for the 10-element array is (the purpose of original) We create a new 12-element array and have arr use it. We copy the 10 elements from original to arr; the two extra elements in the new arr have some default value We inform the system .

TÀI LIỆU MỚI ĐĂNG
31    250    0    27-04-2024
34    212    1    27-04-2024
14    172    0    27-04-2024
10    156    0    27-04-2024
20    198    2    27-04-2024
37    141    0    27-04-2024
10    116    0    27-04-2024
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.