• Tidak ada hasil yang ditemukan

Fundamentals of Programming

N/A
N/A
Protected

Academic year: 2024

Membagikan "Fundamentals of Programming"

Copied!
60
0
0

Teks penuh

(1)

Fundamentals of Programming

lecture 19

Pointers and Arrays,

Pointer Arithmetic

(2)

Array arguments are addresses

(3)

Array arguments vs Pointers

(4)

Array arguments vs Pointers

(5)

The following are equivalent

(6)

Arrays vs. Pointers

(7)

Arrays vs. Pointers

(8)

Arrays vs. Pointers

(9)

Arrays vs. Pointers

(10)

Arrays vs. Pointers

(11)

Arrays vs. Pointers

(12)

Arrays vs. Pointers

(13)

Arrays vs. Pointers

(14)

Arrays vs. Pointers

(15)

Arrays vs. Pointers

pointerarray7.c

(16)

Arrays vs. Pointers

(17)

Arrays vs. Pointers

(18)

Arrays vs. Pointers

(19)

Arrays vs. Pointers

(20)

Arrays vs. Pointers

(21)

Arrays vs. Pointers

(22)

Arrays vs. Pointers

(23)

Arrays vs. Pointers

pointerarray10.c pointers and arrays are the same right?

(24)

Arrays vs. Pointers

(25)

Arrays vs. Pointers

(26)

Arrays vs. Pointers

(27)

Arrays vs. Pointers

pointerarray11.c

(28)

Arrays vs. Pointers

pointerarray11.c

somehow, similar to int * const p;

(29)

Arrays vs. Pointers: size

(30)

Arrays vs. Pointers: size

(31)

Arrays vs. Pointers: size

pointerarray12.c

Addressed are stored in 8 bytes in

(32)

Arrays vs. Pointers: size

(33)

Arrays vs. Pointers: size

pointerarray12.c

Addressed are stored in 4 bytes in

(34)

Array arguments: size

(35)

Array arguments: size

(36)

Array arguments: size

pointerarray14.c

(37)

Pointer Arithmetic

(38)

Pointer Arithmetic

(39)

Pointer Arithmetic

pointerarithmetic1.c

(40)

Pointer arithmetic: pointer + integer

(41)

Pointer arithmetic: pointer + integer

pointerarithmetic2.c

4 3 2 1

2012 2008 2004 a = 2000

5 Memory

2016

(42)

Pointer arithmetic: pointer + integer

pointerarithmetic2.c

4 3 2 1

2012 2008 2004 a = 2000

Memory

2016 p = 2000

(43)

Pointer arithmetic: pointer + integer

pointerarithmetic2.c

4 3 2 1

2012 2008 2004 a = 2000

5 Memory

2016 p = 2000

p+1 = ?

p+2 = ?

(44)

Pointer arithmetic: pointer + integer

pointerarithmetic2.c

4 3 2 1

2012 2008 2004 a = 2000

Memory

2016 p = 2000

p+1 = 2004

p+2 = 2008

(45)

Pointer arithmetic: pointer + integer

pointerarithmetic2.c

4 3 2 1

2012 2008 2004 a = 2000

5 Memory

2016 p = 2000

p+1 = 2004

p+2 = 2008

(46)

The precedence table

*p+i

*(p+i)

(47)

pointer definition

(48)

pointer definition

(49)

pointer definition

(50)

pointer definition

(51)

pointer arithmetic & arrays

(52)

pointer arithmetic & arrays

pointerarithmetic5.c pointerarithmetic6.c

(53)

pointer arithmetic & arrays

a[0] *a a[i] *(a+i)

pointerarithmetic5.c pointerarithmetic6.c

(54)

pointer arithmetic & arrays

(55)

pointer arithmetic & arrays

(56)

pointerarithmetic8.c

(57)

Exercise

(58)

Exercise

(59)

Subtracting two pointers

int a[10];

int *p = a;

int *q = &a[6];

int i = q - p;

(60)

Subtracting two pointers

int a[10];

int *p = a;

int *q = &a[6];

int i = q - p;

Referensi

Dokumen terkait

In the parallel programming, the execution is as simultaneous tasks, and these tasks are kept in the queues, based on that, control on way of Scheduling of task exit from the queue as

At this stage the process is carried out using the PHP program where the sorting of the data is sorted using the PHP programming language which provides a sort function to sort

It goes deep to show what makes Python such a dynamic programming language, starting from how to set it up on your computer, what the different data types it uses are, what

Some possible challenges and obstacles that may be encountered in this process are: Lack of training and preparation of teachers in the field of programming and technology, causing them

Therefore, the objectives of the research are to modify a linear programming model for the optimization of cost in lamb feed formulation, to determine the optimal amount of feed

The result from using the variation of feed rate, maximum stepdown, and depth of cut on the processing time on CNC milling programming variation are resulting good parameters choice for

3.2.2 The Root Definition The root definition RD for this study based on the PQR formula is teaching students the fundamentals of programming within the given time frame by changing

The stages of establishing a diet menu problem model based on the Boolean Linear Programming approach are carried out as follows: examine the problem, determine the notations, indexes,