Lecture Introduction to Computer Programming - Lecture 18

The contents of this chapter include all of the following: Recursive functions, introduction to array, accessing elements of array, a simple array program, a program to calculate percentage marks, array initialization, bound checking, passing array element to a function, pointer arithmetic. | CSC141- Introduction to Computer programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture – 18 Thanks to Reference Book & its website for lecture material Computer Science: A Structured Programming Approach Using C; Chapter 10 1 Pointers Engineering H192 Winter 2005 Lecture 14 2 Narrator: Lecture 14: Introduction to Pointers POINTERS Pointers are variables that contain memory addresses as their values. A variable name directly references a value. A pointer indirectly references a value. Referencing a value through a pointer is called indirection. A pointer variable must be declared before it can be used. Engineering H192 Winter 2005 Lecture 14 3 Instructor: Students have already used pointer without knowing it when they declare FILE variables, which basically point to the address where a file stream is located. Narrator: Pointers are variables that contain instead of data, the memory address where the data exists as their values. It can be said that a regular variable name directly references the value in that variable. A pointer, on the other hand, indirectly references a value. Referencing through a pointer is called indirection. Like any other variable, a pointer must be declared before it can be used. Concept of Address and Pointers Memory can be conceptualized as a linear set of data locations. Variables reference the contents of a locations The contents (value) of a pointers are the address of a given location Contents1 Contents11 Contents16 ADDR1 ADDR2 ADDR3 ADDR4 ADDR5 ADDR6 * * * ADDR11 * * ADDR16 Engineering H192 Winter 2005 Lecture 14 4 Instructor: A computer has two basic types of busses to the memory: an address and data bus. Thus far we have been concerned mainly with the data we store but not its storage location. Pointers allow us to also use the address in which our data is stored in various ways. This conceptualization of memory can be likened to a street with various address where mail is delivered. The mailman delivers the correct data (letters) to | CSC141- Introduction to Computer programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture – 18 Thanks to Reference Book & its website for lecture material Computer Science: A Structured Programming Approach Using C; Chapter 10 1 Pointers Engineering H192 Winter 2005 Lecture 14 2 Narrator: Lecture 14: Introduction to Pointers POINTERS Pointers are variables that contain memory addresses as their values. A variable name directly references a value. A pointer indirectly references a value. Referencing a value through a pointer is called indirection. A pointer variable must be declared before it can be used. Engineering H192 Winter 2005 Lecture 14 3 Instructor: Students have already used pointer without knowing it when they declare FILE variables, which basically point to the address where a file stream is located. Narrator: Pointers are variables that contain instead of data, the memory address where the data exists as their values. It can be said that a regular variable name directly .

Bấm vào đây để xem trước nội dung
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.