Pointers (1A) Young Won Lim 11/1/17

Size: px
Start display at page:

Download "Pointers (1A) Young Won Lim 11/1/17"

Transcription

1 Pointers (1A)

2 Copyright (c) Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". Please send corrections (or suggestions) to youngwlim@hotmail.com. This document was produced by using OpenOffice.

3 Array of Pointers (1) int a [4]; int * b [4]; Array name a holds the starting address int a [4] No. of elements = 4 Type of each element Array name b holds the starting address int * a [4] No. of elements = 4 Type of each element Pointers 3

4 Array of Pointers (2) int a [4]; int * b [4]; (int *) a (int * *) b b[0] int a[0] (int *) b[0] a[1] (int *) b[1] b[1] int a[2] (int *) b[2] a[3] (int *) b[3] b[2] int b[3] int Pointers 4

5 A 2-D Array via a double pointer int c [4] [4]; (int * *) c (int *) c[0] (int *) c[1] (int *) c[2] (int *) c[3] int c[4] [4] c[0] c[1] c[2] c[3] c[0][0] c[0][1] c[0][2] c[0][3] c[1][0] c[1][1] c[1][2] c[1][3] c[2][0] c[2][1] c[2][2] c[2][3] c[3][0] c[3][1] c[3][2] c[3][3] c [i][j] (*(c+i))[j] *(*(c+i)+j) Pointers 5

6 A 2-D array via a single pointer int * p =c[0]; int c [4] [4]; c[0] (int * *) c (int *) c[0] (int *) c[1] (int *) c[2] (int *) c[3] c[i][j] c[1] c[2] c[3] c[0][0] c[0][1] c[0][2] c[0][3] c[1][0] c[1][1] c[1][2] c[1][3] c[2][0] c[2][1] c[2][2] c[2][3] c[3][0] c[3][1] c[3][2] c[3][3] 0=[0*4+0] 1=[0*4+1] 2=[0*4+2] 3=[0*4+3] 4=[1*4+0] 5=[1*4+1] 6=[1*4+2] 7=[1*4+3] 8=[2*4+0] 9=[2*4+1] 10=[2*4+2] 11=[2*4+3] 12=[3*4+0] 13=[3*4+1] 14=[3*4+2] 15=[3*4+3] p[i*4+j] Pointers 6

7 2-D Array Dynamic Memory Allocation (1) int ** d ; d = (int **) malloc (4 * size of (int *)); for (i=0; i<4; ++i) d[i] = (int *) malloc(4 * sizeof); (int **) d (int *) (int *) (int *) (int *) d[0] d[1] d[2] d[3] Pointers 7

8 2-D Array Dynamic Memory Allocation (2) int ** d ; d = (int **) malloc (4 * size of (int *)); for (i=0; i<4; ++i) d[i] = (int *) malloc(4 * sizeof); &d (int **) d (int *) (int *) (int *) (int *) d[0] d[1] d[2] d[3] d[0][0] d[0][1] d[0][2] d[0][3] d[1][0] d[1][1] d[1][2] d[1][3] d[2][0] d[2][1] d[2][2] d[2][3] d[3][0] d[3][1] d[3][2] d[3][3] Pointers 8

9 Pointer to array (1) int a [4]; int a [4] (int []) a int (*p) [4] pointer to the array of 4 elements a[0] a[1] a[2] a[3] int m ; an integer variable int *n ; a pointer variable int func (int a, int b) ; a prototype int (* fp) (int a, int b) ; a function's type int * fp (int a, int b) ; function pointer Pointers 9

10 Pointer to array (2) int (*p) [4] ; (int (*) []) p int a [4] p (int []) *p a *p = a (*p) = a &(*p) = &a p = &a sizeof(p)= 4 bytes sizeof(*p)= 16 bytes a[0] a[1] a[2] a[3] an array with 4 integer elements Pointers 10

11 Pointer to array (3) &p int (*p) [4] ; int c[4] [4] (int (*) []) p p = c (*p) [ i ][ j ]; a 2-d array with 4 rows and 4 columns (int (*) []) p (int []) (int []) (int []) (int []) c *p c[0] c[1] c[2] c[3] *(p+0) *(p+1) *(p+2) *(p+3) c[0][0] c[0][1] c[0][2] c[0][3] c[1][0] c[1][1] c[1][2] c[1][3] c[2][0] c[2][1] c[2][2] c[2][3] c[3][0] c[3][1] c[3][2] c[3][3] Pointers 11

12 Pointer to array (4) int c [4][4]; int (*p) [4]; p = c; func(p,... ); void func(int (*x)[4],... ) { } x[r][c] = void func(int x[ ][4],... ) { } x[r][c] = Pointers 12

13 const type, const pointer type (1) const int * p; int * const q ; const int * const r ; Pointers 13

14 const type, const pointer type (2) const int * p; int * const q ; read only integer integer wr integer p address read only q q address wr Pointers 14

15 const type, const pointer type (3) const int * const r ; read only r r address wr read only integer integer wr Pointers 15

16 Pointer Types and Associated Data 8 bits data data data increasing address char val short val int val pc ps pi address address address char *pc; short *ps; int *pi; Pointers 16

17 Pointer Types 8 bits data data data increasing address pc ps pi address address address char *pc; short *ps; int *pi; Pointers 17

18 Little Endian Example 8 bits 8 bits data data &a increasing address &c &b c b a int a; short b; char c; the order of definition &b &c a b c increasing address &a Pointers 18

19 int *, short *, char * type variables int * pi; short * ps; char * pc; pi ps pc address Not a sized representation Pointers 19

20 Pointer Variable Assignment 8 bits &c &b &a data c b a pi ps pc address char * pc; short * ps; int * pi; int a; short b; char c; pi = &a; ps = &b; pc = &c; Pointers 20

21 Pointer Type Casting 8 bits data data data &a a *pc &a a *ps &a *pi a pc ps pi address address address char *pc; pc = (char *) &a short *ps; ps = (short *) &a int *pi; pi = (int *) &a Pointers 21

22 Accessing bytes of a variable 8 bits data data pc+3 *(pc+3) pc+3 a pc+2 pc+1 *(pc+2) *(pc+1) pc+2 pc+1 &a pc &a *(pc+0) pc pc pc address address char *pc; pc = (char *) &a char *pc; pc = (char *) &a Pointers 22

23 32-bit and 64-bit Address 32-bit machine : address : 4 bytes 64-bit machine : address : 8 bytes 8 bits 8 bits pi ps pc 64-bit machine address : 8 bytes 32-bit machine address : 4 bytes Pointers 23

24 64-bit machine : 8-byte address pi ps pc char *pc; short *ps; int *pi; Pointers 24

25 64-bit machine : 8-byte address & data buses 8 bits char *pc; pc 8 bits short *ps; ps 8 bits int *pi; pi Pointers 25

26 32-bit machine : 4-byte address pi ps pc char *pc; short *ps; int *pi; Pointers 26

27 64-bit machine : 8-byte address and data buses 8 bits pc char *pc; 8 bits ps short *ps; 8 bits pi int *pi; Pointers 27

28 References [1] Essential C, Nick Parlante [2] Efficient C Programming, Mark A. Weiss [3] C A Reference Manual, Samuel P. Harbison & Guy L. Steele Jr. [4] C Language Express, I. K. Chun

Applications of Pointers (1A) Young Won Lim 12/26/17

Applications of Pointers (1A) Young Won Lim 12/26/17 Applications of (1A) Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

Pointers (1A) Young Won Lim 1/9/18

Pointers (1A) Young Won Lim 1/9/18 Pointers (1A) Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Pointers (1A) Young Won Lim 1/5/18

Pointers (1A) Young Won Lim 1/5/18 Pointers (1A) Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Pointers (1A) Young Won Lim 10/18/17

Pointers (1A) Young Won Lim 10/18/17 Pointers (1A) Coyright (c) 2010-2013 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Pointers (1A) Young Won Lim 10/23/17

Pointers (1A) Young Won Lim 10/23/17 Pointers (1A) Coyright (c) 2010-2013 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Pointers (1A) Young Won Lim 1/14/18

Pointers (1A) Young Won Lim 1/14/18 Pointers (1A) Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Applications of Pointers (1A) Young Won Lim 2/27/18

Applications of Pointers (1A) Young Won Lim 2/27/18 Alications of (1A) Coyright (c) 2010-2018 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Applications of Pointers (1A) Young Won Lim 3/14/18

Applications of Pointers (1A) Young Won Lim 3/14/18 (1A) Coyright (c) 2010-2018 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version ublished

More information

Applications of Pointers (1A) Young Won Lim 3/21/18

Applications of Pointers (1A) Young Won Lim 3/21/18 (1A) Coyright (c) 2010-2018 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version ublished

More information

Applications of Pointers (1A) Young Won Lim 3/31/18

Applications of Pointers (1A) Young Won Lim 3/31/18 (1A) Coyright (c) 2010-2018 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version ublished

More information

Applications of Pointers (1A) Young Won Lim 1/5/18

Applications of Pointers (1A) Young Won Lim 1/5/18 Alications of (1A) Coyright (c) 2010-2017 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Applications of Pointers (1A) Young Won Lim 4/11/18

Applications of Pointers (1A) Young Won Lim 4/11/18 (1A) Coyright (c) 2010-2018 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version ublished

More information

Pointers (1A) Young Won Lim 1/22/18

Pointers (1A) Young Won Lim 1/22/18 Pointers (1A) Copyright (c) 2010-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Pointers (1A) Young Won Lim 3/5/18

Pointers (1A) Young Won Lim 3/5/18 Pointers (1A) Copyright (c) 2010-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Pointers (1A) Young Won Lim 2/6/18

Pointers (1A) Young Won Lim 2/6/18 Pointers (1A) Copyright (c) 2010-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Pointers (1A) Young Won Lim 2/10/18

Pointers (1A) Young Won Lim 2/10/18 Pointers (1A) Copyright (c) 2010-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Applications of Arrays (1A) Young Won Lim 2/11/17

Applications of Arrays (1A) Young Won Lim 2/11/17 Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Applications of Arrays (1A) Young Won Lim 3/15/17

Applications of Arrays (1A) Young Won Lim 3/15/17 Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Applications of Pointers (1A) Young Won Lim 4/24/18

Applications of Pointers (1A) Young Won Lim 4/24/18 (1A) Coyright (c) 2010-2018 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version ublished

More information

Arrays (1A) Young Won Lim 12/4/17

Arrays (1A) Young Won Lim 12/4/17 Arrays (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Arrays (1A) Young Won Lim 1/27/17

Arrays (1A) Young Won Lim 1/27/17 Arrays (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Overview (1A) Young Won Lim 9/14/17

Overview (1A) Young Won Lim 9/14/17 Overview (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Overview (1A) Young Won Lim 9/9/17

Overview (1A) Young Won Lim 9/9/17 Overview (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Overview (1A) Young Won Lim 9/25/17

Overview (1A) Young Won Lim 9/25/17 Overview (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Type (1A) Young Won Lim 2/17/18

Type (1A) Young Won Lim 2/17/18 Type (1A) Copyright (c) 2010-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Function Overview (1A) Young Won Lim 10/23/17

Function Overview (1A) Young Won Lim 10/23/17 Function Overview (1A) Copyright (c) 2010 2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or

More information

Pointers (1A) Young Won Lim 12/4/17

Pointers (1A) Young Won Lim 12/4/17 Pointers (1A) Coyright (c) 2010-2017 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Memory Arrays (4H) Gate Level Design. Young Won Lim 3/15/16

Memory Arrays (4H) Gate Level Design. Young Won Lim 3/15/16 Arrays (4H) Gate Level Design Young Won Lim 3/15/16 Copyright (c) 2011, 2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation

More information

Applications of Structures (1A) Young Won Lim 12/8/17

Applications of Structures (1A) Young Won Lim 12/8/17 Applications of (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

Applications of Structures (1A) Young Won Lim 12/4/17

Applications of Structures (1A) Young Won Lim 12/4/17 Applications of (1A) Copyright (c) 2009-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

Applications of Array Pointers (1A) Young Won Lim 11/22/18

Applications of Array Pointers (1A) Young Won Lim 11/22/18 Appliations of Array Pointers (1A) Copyright () 2010-2018 Young W. Lim. Permission is granted to opy, distribute and/or modify this doument under the terms of the GNU Free Doumentation Liense, Version

More information

File (1A) Young Won Lim 11/25/16

File (1A) Young Won Lim 11/25/16 File (1A) Copyright (c) 2010-2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Structure (1A) Young Won Lim 7/30/13

Structure (1A) Young Won Lim 7/30/13 Structure (1A) Copyright (c) 2010 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Memory (1A) Young Won Lim 9/7/17

Memory (1A) Young Won Lim 9/7/17 (1A) Copyright (c) 21-26 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Structures (1A) Young Won Lim 12/4/17

Structures (1A) Young Won Lim 12/4/17 Structures (1A) Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Arrays and Strings (2H) Young Won Lim 3/7/18

Arrays and Strings (2H) Young Won Lim 3/7/18 Arrays and Strings (2H) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or

More information

Number System (1A) Young Won Lim 7/7/10

Number System (1A) Young Won Lim 7/7/10 Number System (A) 7/7/ Copyrigt (c) 9-6 Young W. Lim. Permission is granted to copy, distribute and/or modify tis document under te terms of te GNU ree Documentation License, Version. or any later version

More information

Structures (1A) Young Won Lim 11/8/16

Structures (1A) Young Won Lim 11/8/16 Structures (1A) Copyright (c) 2010-2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Example 1. Young Won Lim 11/17/17

Example 1. Young Won Lim 11/17/17 Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Example 1 : using 1-d arrays. Young Won Lim 12/13/17

Example 1 : using 1-d arrays. Young Won Lim 12/13/17 : using 1-d arrays Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

Variables (2D) Young Won Lim 3/28/18

Variables (2D) Young Won Lim 3/28/18 Variables (2D) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Example 2. Young Won Lim 11/24/17

Example 2. Young Won Lim 11/24/17 Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

ELF (1A) Young Won Lim 10/22/14

ELF (1A) Young Won Lim 10/22/14 ELF (1A) Copyright (c) 2010-2014 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Example 3 : using a structure array. Young Won Lim 11/25/17

Example 3 : using a structure array. Young Won Lim 11/25/17 : using a structure array Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2

More information

Accessibility (1A) Young Won Lim 8/22/13

Accessibility (1A) Young Won Lim 8/22/13 Accessibility (1A) Copyright (c) 2011-2013 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

Example 3. Young Won Lim 11/22/17

Example 3. Young Won Lim 11/22/17 Copyright (c) 2010-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Expressions (2E) Young Won Lim 3/10/18

Expressions (2E) Young Won Lim 3/10/18 Expressions (2E) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Class (1A) Young Won Lim 9/8/14

Class (1A) Young Won Lim 9/8/14 Class (1A) Copyright (c) 2011-2013 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Pointers (2G) Young Won Lim 3/7/18

Pointers (2G) Young Won Lim 3/7/18 Pointers (2G) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Expressions (2E) Young Won Lim 4/9/18

Expressions (2E) Young Won Lim 4/9/18 Expressions (2E) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Program Structure (2A) Young Won Lim 3/8/18

Program Structure (2A) Young Won Lim 3/8/18 Program Structure (2A) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or

More information

Program Structure (2A) Young Won Lim 5/28/18

Program Structure (2A) Young Won Lim 5/28/18 Program Structure (2A) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or

More information

ARM Assembly Exercise (1B) Young Won Lim 7/16/16

ARM Assembly Exercise (1B) Young Won Lim 7/16/16 ARM Assembly Exercise (1B) Copyright (c) 2014-2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2

More information

RAM (1A) Young Won Lim 11/12/13

RAM (1A) Young Won Lim 11/12/13 RAM (1A) Young Won Lim 11/12/13 opyright (c) 2011-2013 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version

More information

Side Effects (3A) Young Won Lim 1/13/18

Side Effects (3A) Young Won Lim 1/13/18 Side Effects (3A) Copyright (c) 2016-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Functions (4A) Young Won Lim 5/8/17

Functions (4A) Young Won Lim 5/8/17 Functions (4A) Copyright (c) 2015 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Structures (2I) Young Won Lim 4/17/18

Structures (2I) Young Won Lim 4/17/18 Structures (2I) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

ELF (1A) Young Won Lim 3/24/16

ELF (1A) Young Won Lim 3/24/16 ELF (1A) Copyright (c) 21-216 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Functions (4A) Young Won Lim 3/16/18

Functions (4A) Young Won Lim 3/16/18 Functions (4A) Copyright (c) 2015 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Algorithms Bubble Sort (1B) Young Won Lim 4/5/18

Algorithms Bubble Sort (1B) Young Won Lim 4/5/18 Algorithms Bubble Sort (1B) Young Won Lim 4/5/18 Copyright (c) 2017 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation

More information

A Sudoku Solver (1A) Richard Bird Implementation. Young Won Lim 11/15/16

A Sudoku Solver (1A) Richard Bird Implementation. Young Won Lim 11/15/16 A Sudoku Solver (1A) Richard Bird Implementation Copyright (c) 2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,

More information

Structures (2I) Young Won Lim 3/7/18

Structures (2I) Young Won Lim 3/7/18 Structures (2I) Copyright (c) 2014-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Side Effects (3B) Young Won Lim 11/27/17

Side Effects (3B) Young Won Lim 11/27/17 Side Effects (3B) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Tiny CPU Data Path (2B) Young Won Lim 5/2/16

Tiny CPU Data Path (2B) Young Won Lim 5/2/16 Tiny CPU Data Path (2B) Copyright (c) 24-26 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version.2 or any later

More information

Day08 A. Young W. Lim Mon. Young W. Lim Day08 A Mon 1 / 27

Day08 A. Young W. Lim Mon. Young W. Lim Day08 A Mon 1 / 27 Day08 A Young W. Lim 2017-10-16 Mon Young W. Lim Day08 A 2017-10-16 Mon 1 / 27 Outline 1 Based on 2 C Functions (2) Storage Class and Scope Storage Class Specifiers A. Storage Duration B. Scope C. Linkage

More information

Class (1A) Young Won Lim 11/20/14

Class (1A) Young Won Lim 11/20/14 Class (1A) Copyright (c) 2011 2014 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Polymorphism (1A) Young Won Lim 8/22/13

Polymorphism (1A) Young Won Lim 8/22/13 Polymorhism (1A) Coyright (c) 2011-2012 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Polymorphism (1A) Young Won Lim 8/15/13

Polymorphism (1A) Young Won Lim 8/15/13 Polymorhism (1A) Coyright (c) 2011-2012 Young W. Lim. Permission is granted to coy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Algorithms (7A) Young Won Lim 4/10/17

Algorithms (7A) Young Won Lim 4/10/17 Algorithms (7A) Copyright (c) 2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Arrays. Young W. Lim Mon. Young W. Lim Arrays Mon 1 / 17

Arrays. Young W. Lim Mon. Young W. Lim Arrays Mon 1 / 17 Arrays Young W. Lim 2017-02-06 Mon Young W. Lim Arrays 2017-02-06 Mon 1 / 17 Outline 1 Introduction References Array Background Young W. Lim Arrays 2017-02-06 Mon 2 / 17 Based on "Self-service Linux: Mastering

More information

Day05 A. Young W. Lim Sat. Young W. Lim Day05 A Sat 1 / 14

Day05 A. Young W. Lim Sat. Young W. Lim Day05 A Sat 1 / 14 Day05 A Young W. Lim 2017-10-07 Sat Young W. Lim Day05 A 2017-10-07 Sat 1 / 14 Outline 1 Based on 2 Structured Programming (2) Conditions and Loops Conditional Statements Loop Statements Type Cast Young

More information

Algorithms (7A) Young Won Lim 4/18/17

Algorithms (7A) Young Won Lim 4/18/17 Algorithms (7A) Copyright (c) 2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

Polymorphism Overview (1A) Young Won Lim 2/20/18

Polymorphism Overview (1A) Young Won Lim 2/20/18 Polymorphism Overview (1A) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2

More information

Side Effects (3B) Young Won Lim 11/20/17

Side Effects (3B) Young Won Lim 11/20/17 Side Effects (3B) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Side Effects (3B) Young Won Lim 11/23/17

Side Effects (3B) Young Won Lim 11/23/17 Side Effects (3B) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

At this time we have all the pieces necessary to allocate memory for an array dynamically. Following our example, we allocate N integers as follows:

At this time we have all the pieces necessary to allocate memory for an array dynamically. Following our example, we allocate N integers as follows: Pointers and Arrays Part II We will continue with our discussion on the relationship between pointers and arrays, and in particular, discuss how arrays with dynamical length can be created at run-time

More information

Arrays. Young W. Lim Wed. Young W. Lim Arrays Wed 1 / 19

Arrays. Young W. Lim Wed. Young W. Lim Arrays Wed 1 / 19 Arrays Young W. Lim 2017-02-08 Wed Young W. Lim Arrays 2017-02-08 Wed 1 / 19 Outline 1 Introduction References Array Background Young W. Lim Arrays 2017-02-08 Wed 2 / 19 Based on "Self-service Linux: Mastering

More information

Haskell Overview II (2A) Young Won Lim 8/9/16

Haskell Overview II (2A) Young Won Lim 8/9/16 (2A) Copyright (c) 2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

State Monad (3D) Young Won Lim 9/25/17

State Monad (3D) Young Won Lim 9/25/17 Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Binary Search Tree (3A) Young Won Lim 6/2/18

Binary Search Tree (3A) Young Won Lim 6/2/18 Binary Search Tree (A) /2/1 Copyright (c) 2015-201 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2

More information

Day02 A. Young W. Lim Sat. Young W. Lim Day02 A Sat 1 / 12

Day02 A. Young W. Lim Sat. Young W. Lim Day02 A Sat 1 / 12 Day02 A Young W. Lim 2017-10-07 Sat Young W. Lim Day02 A 2017-10-07 Sat 1 / 12 Outline 1 Based on 2 Introduction (2) - Basic Elements Basic Elements in C Programming Young W. Lim Day02 A 2017-10-07 Sat

More information

Access. Young W. Lim Sat. Young W. Lim Access Sat 1 / 19

Access. Young W. Lim Sat. Young W. Lim Access Sat 1 / 19 Access Young W. Lim 2017-06-10 Sat Young W. Lim Access 2017-06-10 Sat 1 / 19 Outline 1 Introduction References IA32 Operand Forms Data Movement Instructions Data Movement Examples Young W. Lim Access 2017-06-10

More information

Libraries (1A) Young Won Lim 6/5/17

Libraries (1A) Young Won Lim 6/5/17 Libraries (1A) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Methods (2A) Young Won Lim 10/14/14

Methods (2A) Young Won Lim 10/14/14 Methods (2A) Copyright (c) 2011-2013 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Binary Search Tree (2A) Young Won Lim 5/17/18

Binary Search Tree (2A) Young Won Lim 5/17/18 Binary Search Tree (2A) Copyright (c) 2015-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or

More information

Structure (1A) Component

Structure (1A) Component Component Copyright (c) 2012 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version

More information

CORDIC Fixed Point Simulation. Young Won Lim 2/28/12

CORDIC Fixed Point Simulation. Young Won Lim 2/28/12 CORDIC Fixed Point Simulation Copyright (c) 2012 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or

More information

HW / SW Implementation Overview (0A) Young Won Lim 7/16/16

HW / SW Implementation Overview (0A) Young Won Lim 7/16/16 HW / SW Implementation Copyright (c) 213-216 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

Monad (1A) Young Won Lim 6/9/17

Monad (1A) Young Won Lim 6/9/17 Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

CSC231 C Tutorial Fall 2018 Introduction to C

CSC231 C Tutorial Fall 2018 Introduction to C mith College CSC231 C Tutorial Fall 2018 Introduction to C Dominique Thiébaut dthiebaut@smith.edu Learning C in 4 Installments! Dennis Ritchie 1969 to 1973 AT&T Bell Labs Close to Assembly Unix Standard

More information

Procedure Calls. Young W. Lim Mon. Young W. Lim Procedure Calls Mon 1 / 29

Procedure Calls. Young W. Lim Mon. Young W. Lim Procedure Calls Mon 1 / 29 Procedure Calls Young W. Lim 2017-08-21 Mon Young W. Lim Procedure Calls 2017-08-21 Mon 1 / 29 Outline 1 Introduction Based on Stack Background Transferring Control Register Usage Conventions Procedure

More information

Haskell Overview IV (4A) Young Won Lim 10/13/16

Haskell Overview IV (4A) Young Won Lim 10/13/16 (4A) Copyright (c) 2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Pthread (9A) Pthread

Pthread (9A) Pthread Pthread (9A) Pthread Copyright (c) 2012 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

The Complexity of Algorithms (3A) Young Won Lim 4/3/18

The Complexity of Algorithms (3A) Young Won Lim 4/3/18 Copyright (c) 2015-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Haskell Overview III (3A) Young Won Lim 10/4/16

Haskell Overview III (3A) Young Won Lim 10/4/16 (3A) Copyright (c) 2016 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published

More information

Fundamental of Programming (C)

Fundamental of Programming (C) Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 9 Pointer Department of Computer Engineering 1/46 Outline Defining and using Pointers

More information

Eulerian Cycle (2A) Young Won Lim 4/26/18

Eulerian Cycle (2A) Young Won Lim 4/26/18 Eulerian Cycle (2A) Copyright (c) 2015 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any

More information

Procedure Calls. Young W. Lim Sat. Young W. Lim Procedure Calls Sat 1 / 27

Procedure Calls. Young W. Lim Sat. Young W. Lim Procedure Calls Sat 1 / 27 Procedure Calls Young W. Lim 2016-11-05 Sat Young W. Lim Procedure Calls 2016-11-05 Sat 1 / 27 Outline 1 Introduction References Stack Background Transferring Control Register Usage Conventions Procedure

More information

Background Functions (1C) Young Won Lim 4/3/18

Background Functions (1C) Young Won Lim 4/3/18 Background Functions (1C) Copright (c) 2016-2017 Young W. Lim. Permission is granted to cop, distribute and/or modif this document under the terms of the GNU Free Documentation License, Version 1.2 or

More information

FPGA Configuration (1C) Young Won Lim 12/1/13

FPGA Configuration (1C) Young Won Lim 12/1/13 (1C) Young Won Lim 12/1/13 Copyright (c) 2011-2013 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2

More information