Sams Teach Yourself C in 24 Hours (79 page)

BOOK: Sams Teach Yourself C in 24 Hours
6.78Mb size Format: txt, pdf, ePub

sions, 419

assignment (=), 92

unary, deference opera-

passing

binary, multiplication

tors (*), 182

arguments

(*), 182

optimizers, turning off,

to functions, 47-48

bit-manipulation, 130

235

to main () functions,

bitwise AND (&),

output

305

131

aligning, 83-84

arrays, to functions,

bitwise complement

format specifiers, 79

266-267

(tilde), 131

%c, 60-62

functions, with pointers,

bitwise OR (|), 131

%d, 63-64

322-323

bitwise XOR (^),

%E, 67

multidimensional

131

%f, 65-67

arrays, to functions,

left-shift (<<),

minimum field width

270-272

133-135

specifiers, 81-83

pointers, 268-270, 322

right-shift (>),

precision specifiers,

structures, to functions,

133-135

84-85

319-321

cast, 101-102

performance, comments,

cautions, 419

30

34 067231861x index 1/25/00 10:45 AM Page 522

522

Perl

Perl, 14

pre-decrement operator

programming languages

pointers, 176, 430

(--), 96

C++, 14

arrays

pre-increment operator

compiled, 14

accessing, 264-266

(++), 96

high-level, 12-14

declaring, 272

precedence (of opera-

interpreted, 15

referencing with,

tors), 43, 98-99

levels, 12

195-196

precision specifiers, 84-85

Perl, 14

strings, 272-274

preprocessor.
See
C pre-

programming style, 418-

character constants,

processor

419

assigning, 210

preprocessor directives.

programs

character strings,

See
directives

C preprocessor, 392

assigning, 210-211

printf() function, 78-79,

# (pound sign), 392

declaring, 179-181

386

C compiler compari-

dereferenced, 323

format specifiers, 78-79

son, 392-393, 405

file pointers, 357, 371

adding h to, 147-148

directives.
See
direc-

to functions, declaring,

adding L to, 147-148

tives

274-275

%c, 60-62

macro body, 392,

integers, 259

%d, 63-64

396

moving, 260-262

%e, 67

macro names,

multiple, 185-186

%f, 65-67

392-393

null, 183

%p, 179

macro substitution,

passing, 268-270, 322

%s, 217

392-396

pointing to objects,

fprintf() function com-

newline characters,

431-432

parison, 381, 388

392

size, 260

printing characters,

executing, 305

structures, referencing,

60-62

file names, .c extension,

322-324

processing variable argu-

28

subtracting, 263-264

ments, 252-254

performance, com-

types, 180

program portability,

ments, 30

uninitialized, errors,

increasing, 234

running

262

program scope (vari-

Borland C++, 23

values, assigning,

ables), 227, 233

Visual C++, 20

180-181

block scope compari-

prototyping functions,

variable values, chang-

son, 227-229

245-247, 432

ing, 183-184

global variables, 227

fixed number of argu-

portability, 13, 36, 234

programming

ments, 251

post-decrement operator

modular, 419-420

no arguments, 248-249

(--), 96

structured

variable number of

post-increment operator

bottom-up, 255

arguments, 251-252

(++), 96

C, 169

PrtSeek() function, 377

pow() function, 150-152

top-down, 255

PtrTell() function, 377

putc() function, 75-76

34 067231861x index 1/25/00 10:45 AM Page 523

rewind() function

523

putchar() function, 77-78

input

dot operator (.),

puts() function, 215-217

getc() function,

335-337, 351

fputs() function com-

72-74

regions (variables), 229

parison, 364

getchar() function,

register keyword, 56, 233

requirements, stdio.h

74-75

registers, 233

header file, 215

scanf() function,

relational operators,

syntax, 215

217-219

98-100

keyboard input, fgets()

equal to (==), 98

function, 366

greater than (>), 98

strings, 217

greater than or equal to

Q-R

real numbers.
See
float-

(>=), 98

ing-point numbers

less than (<), 98

qualifiers.
See
modifiers

realloc() function,

less than or equal to

(variables)

288-291

(<=), 98

reallocating memory,

not equal to (!=), 98

\r (return character), 60

288-291

releasing allocated mem-

random access

recommended reading,

ory, 283-286

code example, 375-378

434-435

remainder assignment

disk files, 374-377, 387

recursive functions,

operator (%=), 93

fseek() function,

303-305

remainder operator (%),

374-378

calling, 303-304

43

ftell() function, 374-378

fRecur(), 304

replacing built-in argu-

readability of code,

running, 305

ments, 308

improving, 296, 300,

redirecting streams, fre-

requirements

419

open() function, 384-388

stdio.h header file, 215

reading

referencing

system requirements,

characters, 215-217

arrays, with pointers,

16-17

files, 360

195-196

reserved words.
See
key-

binary, 378-381

memory locations,

words

fgetc() function,

unions, 341-343, 352

resetting file position

360-363

structure members,

indicators, 378

fgets() function,

315-319

resources, 305, 434-435

363-366, 371

structures

return character (\r), 60

fread() function,

with arrow operators,

return keyword, 34, 56

366-369, 381

324

return types, specifying,

random access,

with pointers, 322-

244

374-377, 387

324

return values, 47

sequential access,

unions, 335, 351

returning times, 250

374

arrow operator (->),

reusability, 14

formatted data

335, 351

rewind() function, 378

fprintf() function,

code example,

code example, 379-384

381-384, 388

335-337

syntax, 378

fscanf() function,

381-384

34 067231861x index 1/25/00 10:45 AM Page 524

524

right value

right value (variables),

semicolons (;), 28

spatial regions (vari-

177, 187

separating data items,

ables), 229

right-hand operands, 92

317

specifiers, storage classes

right-justifying output,

sequential access, disk

auto, 229-231

83-84

files, 374

extern, 234

right-shift operator (>>),

setbuf() function, 387

register, 233

133-135

setjmp() function, 440

static, 230

Ritchie, Dennis, 12

setjmp.h header file, 440

specifying

rounding (division), 100

setlocale() function, 440

sizes, arrays, 267

running

setting null pointers, 183

return types, 244

compilers

setvbuf() function, 387

sqrt() function, 150-152

Borland C++, 23

shift operators, 133-135

stack, 305

Visual C++, 19

short data modifier, 145

standard input stream

programs

short keyword, 56

reading characters from,

Borland C++, 23

sign bits, 142

215-217

Visual C++, 20

signal.h header file, 440

reading strings from,

recursive functions, 305

signed data modifier,

217

142-143

standard input-output

signed keyword, 56

header file, 32

sin() function, 149-150

standard output stream

S

single quotes (‘), 59

writing characters from,

size

217

%s (string format specifi-

pointers, 260

writing characters to,

er), 79

structures, 339-341

215-216

printf() function, 217

unions, 339

standards, 15-16

scanf() function, 217

measuring, 339-341

starting compilers

saving code

structure size com-

Borland C++, 21

Borland C++, 23

parison, 339-341

Visual C++, 18

Visual C++, 19

sizeof keyword, 56

statement blocks, 45-46

scanf() function, 217-219

sizeof operator, 122-123

statements, 45, 426.
See

format specifiers, 217

sizes, arrays

also
functions; loops

fscanf() function com-

calculating, 192-194

break, 155, 164-165

parison, 381

specifying, 267

conditional branching,

syntax, 217

unsized arrays, 201

155

scientific notation, 67

skipping loops, 167

continue, 155, 167-168

scientific notation format

software requirements,

control flow, 426

specifier (%E), 67, 79

16-17

goto, 155, 168-169

scopes (variables)

software engineering, 420

if, 155-158

block, 224-225

source code.
See
code

braces, 156

file, 232

spacing (in code), 419

evaluating condi-

function, 226-227

spaghetti code, 169

tions, 156

nested block, 225-226

program, 227, 233

34 067231861x index 1/25/00 10:45 AM Page 525

subtraction operator

525

executing codes, 156

freopen() function,

structured programming

nesting, 160-161

384-388

bottom-up program-

if-else, 155, 158-159

code example,

ming, 255

looping.
See
loops

385-386

C, 169

null, 112-113

modes, 385-386

top-down programming,

return, 34

syntax, 384

255

switch, 155, 161-164

high-level I/O, 357

structures

static keyword, 56

low-level I/O, 357

arrays

static specifier, 230-231

setbuf() function, 387

arrays of structures,

static specifiers, apply-

setvbuf() function, 387

324-327

ing, 231

stderr, 72

compared, 314

stdarg.h header file, 440

stdin, 72

arrow operators, refer-

stddef.h header file, 301,

stdout, 72

encing, 324

440

text, 356, 370

data types, 314

stderr file stream, 433

string constants, 208, 423

declaring, 314-315

stderr stream, 72

character arrays, initial-

definitions, 315

stdin file stream, 433

izing, 208-211

duplication, avoiding,

stdin stream, 72

character constants,

322

stdio.h file, 32

compared, 209-212

FILE, 357, 374-375,

stdio.h header file, 440

string format specifier

Other books

Fields of Rot by Jesse Dedman
Love and Law by K. Webster
The Crafters Book Two by Christopher Stasheff, Bill Fawcett
The Next Time You See Me by Jones, Holly Goddard
Gutbucket Quest by Piers Anthony
1 Hot Scheming Mess by Lucy Carol
Hearts In Atlantis by Stephen King