• 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

Adkins (2013) flipped the MIS course by having students complete the following activities outside of the classroom: read the assigned chapter from the textbook,

Chapter 15 Government Procurement shall apply to the other covered entities listed in this Section where the value of the procurement is estimated, in accordance with Article 15.2.8

ANNEX 15-A SCHEDULE OF SINGAPORE SECTION A: Central Government Entities Thresholds: Unless otherwise specified, Chapter 15 Government Procurement shall cover procurement by

Chapter I Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 References Appendix I Appendix 2 Appendix 3 Appendix 4 J!RCAS Working Report No.89 Contents List of

28 CHAPTER V CONCLUSION 5.1 Conclusion People rarely know the great potential value that pumpkin have in human health, it is actually studied that pumpkin has a lot of benefits

Bond Contractual Interest Rate 10% 8% 10% 12% Market Interest Rate Bonds Sell at Issued when Premium Face Value Discount Illustration 15-5 Interest rates and bond prices

Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008, John Wiley 15-20 Asynchronous Data Transfers  Each data transfer occurs at random  The data transfer may be