• Tidak ada hasil yang ditemukan

C Programming chapter 15

N/A
N/A
Protected

Academic year: 2017

Membagikan "C Programming chapter 15"

Copied!
41
0
0

Teks penuh

(1)

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

1

פ

15

Preprocessor

"

ע מ

נ

מ ע מ

מ ע

נ ע מ

עמ מ מ

,

מ

נמ

(2)

-

פ

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

2

-0

0000

0

1

0001

1

2

0010

2

3

0011

3

4

0100

4

5

0101

5

6

0110

6

7

0111

(3)

-

פ

'

'

(

)

:

.1

.2

.3

(compiler)

+

.

.4

.

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

(4)

-

C

:

C Data Type Compaq Alpha Typical 32-bit Intel IA32

int

4

4

4

long int

8

4

4

char

1

1

1

short

2

2

2

float

4

4

4

double

8

8

8

long double

8

8

10/12

char *

8

4

4

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

(5)

-

פ

(

)

George Bool

-

19

'

'

ס

1

'

'

-0

And

& 0 1

0 0 0

1 0 1

!

0 1

1 0

Not

Or

| 0 1

0 0 1

1 1 1

^ 0 1

0 0 1

1 1 0

Exclusive-Or (Xor)

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

(6)

-

פ

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

6

0

1

(byte)

C

.

!!!

(char, short, int, long)

-unsigned

(7)

-

פ

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

7

2

(

)

(

8

)

"

0

.

042

34

(8)

-

פ

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

8

(

16

)

"

0x

.

0x42

66

.

%x

(

X

%

)

(9)

-

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

9

:

"

"

2

(

0

)

"

,

0

1

2

3

4

5

6

7

8

1

2

4

8

16

32

64

128

256

2

0

2

1

2

2

2

3

2

4

2

5

2

6

2

7

(10)

-

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

10

,

:

00001101

:

1

=

1

,

0

=

2

,

1

=

4

,

1

=

8

,

0

=

16

,

0

=

32

,

0

=

64

,

0

=

128

"

13

:

1*1+0*2+1*4+1*8+0*16+0*32+0*64+0*128 =

1*1 + 1*4 + 1*8 =

(11)

-

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

11

:

0

-2

,

,

.

,

0

(12)

-

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

12

ס

8

:

00001000

0

8

0

4

0

2

1

1

(13)

-

פ

Shayke Bilu PhD

(14)

-

פ

Shayke Bilu PhD

(15)

-

פ

Shayke Bilu PhD

(16)

SCE-Chapter-15-Preprocessor

Shayke Bilu PhD

16

(17)

ס

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

17

-

#include

-

#define

#undef

macro

(18)

ס

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

(19)

-

Pre-Compiler

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

19

(

Pre-Compiler

/

(Pre-Processor

(

)

(20)

-

#include

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

20

#include

-#include

,

.

2

:

.1

#include

<filename

>

-

.2

#include

ףfilenameפ

-

(

)

"

.

(21)

#include

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

21

#include

<stdio.h>

#include

ף

DefinitionFile.h

פ

#include

ףc:

\\HeaderFiles\\DefinitionFile.h

פ

(22)

פ

(

)

-

#define

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

22

#define

#define

identifier alternative-text

identifier

-alternative-text

identifier

ס

(

.)

(23)

פ

(

)

-

#define

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

23

alternative-text

ס

(

\

)

identifier

identifier

identifier

(

"

"

(24)

-

#define

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

24

#define

OK 1

printf(

ףOKפ

); \\

int

NOT_OK; \\

\\

int

status = OK;

#define

INFINITE

for

(;;)

?

INFINITE printf(

ףHelloפ

);

#define

DOUBLE + NUM + NUM

#define

QUADROUPLE DOUBLE DOUBLE

int

NUM=5;

if

(DOUBLE DOUBLE== 20)

(25)

פ

-

#define

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

25

,

#define

identifier(argument-list) alternative-text

)

identifier

argument-list

alternative-text

#define

max(A,B) ((A)>(B)? (A) : (B))

(26)

פ

-

#define

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

26

inline

-"

A

-B

"

max(i++, j++);

(27)

-

#undef

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

27

"

-

define

:

(28)

SCE-Chapter-15-Preprocessor

Shayke Bilu PhD

28

(29)

-

Conditional Inclusion

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

29

-"

-

conditional-statements

(

)

/

#if

integer

.

-0

,

#elif/#else/#endif

C

-casting

,

sizeof

(30)

ס

פ

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

30

#if

integer-expr1

#elif

integer-expr2

#else

#endif

#include

,

(31)

-

#defined

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

31

defined(name)

1

name

"

#define

-0

header

#if

!defined(INC_FILE)

#define

INC_FILE

//

// header file content

(32)

-

פ

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

32

#if

-#defined

(debugging)

:

#if

defined(DEBUG)

printf(

ףVariable x has value = %dפ

, x);

(33)

-

"

#ifdef

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

33

#define

,

:

#ifndef

INC_FILE

#define

INC_FILE

// header file content

(34)

פ

פ

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

34

LINE

-

FILE

-

DATE

TIME

(35)

פ

פ

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

35

#line

number

ס

-number

.

"

"

#error

error-text

ס

assert(condition)

(

-"

(

ף

assert.h

,

,

(36)

SCE-Chapter-15-Preprocessor

Shayke Bilu PhD

36

(37)

SCE-Chapter-15-Preprocessor

Shayke Bilu PhD

(38)

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

38

.1

.

.2

MINIMUM2

2

.

.

.3

MINIMUM3

3

.

.

.4

PRINTARRAY

.

.

.5

DIVBYTEN

-

10

1

(39)

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

39

.6

ISOCTAL

8

,

1

0

.

.7

ISDECIMAL

10

,

1

0

.

.8

ISHEXADECIMAL

16

,

1

0

.

.9

SWAP

.

.10

DETAILS

(40)

ס

Shayke Bilu PhD

SCE-Chapter-15-Preprocessor

40

:C

-

#include

-

#define

#undef

macro

if

#

-

ס

(41)

SCE-Chapter-15-Preprocessor

Shayke Bilu PhD

41

Referensi

Dokumen terkait

ABSTRAK : Telah dilakukan pengujian pengaruh sari wortel (Daucus carota L.) terhadap tukak lambung pada tikus putih jantan yang diinduksi dengan etanol absolut 1 ml/200 gram

Pertemuan I siklus I ini dilaksanakan pada hari selasa tanggal 8 maret 2016 di kelas IV SD Negeri Kutowinangun 08 Kecamatan Tingkir Kota Salatiga dengan jumlah siswa

Setiap model pembelajaran berangkat dari tujuan dan asumsi, yakni tujuan terhadap proses pembelajaran, serta asumsi yakni dugaan yang tidak perlu dibuktikan keberadaannya.

Judul :Peran Anggaran Sebagai Salah Satu Alat Perencanaan dan Pengendalian Produksi (Studi Kasus Pada Industri Rumah Tangga “Rumah Ubi” Medan).. Medan, Agustus

Beberapa karakteristik yang khas dari bahan pembelajaran tersebut adalah: (1) lengkap (self-contained) , artinya seluruh materi yang diperlukan peserta diklat untuk mencapai

PROGRAM VISUAL FOXPRO. STATISTIK

ilmiah ini adalah terkait referensi, penulisan kutipan, dan daftar rujukan. Mereka kesulitan menemukan referensi yang relevan yang bermutu. Hal ini antara lain

umum pada beberapa kawasan permukiman yang ada. Sementara tantangan yang dihadapi oleh Kabupaten Kerinci dalam. penyelenggaraan pengembangan kawasan permukiman dapat