Sams Teach Yourself C in 24 Hours (78 page)

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

infinite loops, breaking,

bitwise operators, 132

fclose function,

166

break statement,

359-360

initializing arrays, 191

164-165

feof() function, 368-369

initializing strings,

calculating an addition

fgetc() function,

210-211

and printing results to

361-362

initializing structures,

the screen, 50

fgets() function,

318

calculating array size,

364-365

initializing unsized

193

floating-point format

arrays, 202

calling functions after

specifier, 65-66

integer format specifier,

they are declared and

fopen() function,

63

defined, 245

359-360

linked lists

calling recursive func-

for loops, 110, 114-115

calling functions in

tions, 303-304

fprintf() function,

module file,

calloc() function, 287

382-383

416-418

cast operator, 101

fputc() function,

header file, 415

changing variable val-

361-362

module program,

ues via pointers, 183

fputs() function,

410-413

command-line argu-

364-365

logical AND operator,

ments, 306-307

fread() function,

125

conditional operator,

368-369

logical negation opera-

135

freopen() function, redi-

tor (!), 128

continue statement, 167

recting streams,

logical OR operator,

converting numeric val-

385-386

126

ues back to characters,

fscanf() function,

malloc() and free()

61

382-383

functions, 283-285

copying strings, 213

fwrite() function,

malloc() function,

368-369

281-282

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

518

listings

measuring string

processing variable

referencing, 335-336

lengths, 212

arguments, 253-254

referencing memory

minimum field width

put() function, 216

locations, 341-342

specifiers, 82

random access to files,

user input

moving pointers, differ-

375-376

getc() function

ent data types,

realloc() function,

example, 73

260-261

289-290

getchar() function,

multiple pointers, 185

referencing arrays with

74-75

nested conditional com-

pointers, 195

using array, pointer to

pilation, 403-404

referencing structure

character strings,

nested if statements,

members, 316

272-273

160

relational operators, 99

void in function decla-

nested loops, 116

relationship between

rations, 248-249

nested structures,

program and block

while loop example,

327-329

scope, 227

106

obtaining left values,

scanf() function with

writing output, putc()

178

various format speci-

function, 76

passing arrays to func-

fiers, 218

lists

tions, 266-267

shift operators, 134

linked, 410

passing functions with

short and long data

advantages, 410

pointers, 322-323

modifiers, 146

creating, 410-418

passing multidimen-

signed and unsigned

variables, enum data

sional arrays to func-

data modifiers, 144

types, 296

tions, 270-271

simple C program, 28

little-endian format, 343

passing pointers to

sizeof operator,

local scope.
See
block

functions, 268-269

122-123

scope

passing structures to

static specifier, 230

local time, 249

functions, 320

subtracting pointers,

local variables, 225, 418

pointing to functions,

263

locale.h header file, 440

274-275

switch statement, 162

localtime() function, 250

pow90 and sqrt() func-

trigonometry functions,

locations (memory), mul-

tions, 151

149

tiple pointers, 185-186

precision specifiers,

typedef definitions,

logical operators, 124

84-85

301-302

AND (&&), 124-126

printing array of char-

unions

NEGATION (!),

acters, 196

measuring size,

128-129

printing characters, 60

339-340

OR (||), 126-127

printing two-dimension-

memory sharing,

long data modifier,

al arrays, 200

338-339

145-147

printing variables, dif-

nesting in structures,

long keyword, 56

ferent scope levels,

344-345

longjmp() functions, 440

225

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

memory locations

519

loops, 105, 427-428

main() functions, 29, 33,

buffers, 356

continue statement, 171

305

flushing, 356

control flow, 155

arguments, 305-306

high-level I/O, 357

do-while, 107-109

declaring, 306

low-level I/O, 357,

for, 109-112

maintaining C programs,

387

complex expressions

296

setbuf() function,

in, 113-115

malloc() function,

387

null statements,

280-283

setvbuf() function,

112-113

calloc() function, com-

387

infinite, 166-167

pared, 292

locations, multiple

nesting, 116-117

listings, 281-285

pointers, 185-186

skipping, continue

manipulating variables

reallocating, realloc()

statement, 167

indirectly, 176

function, 288-291

while, 106-107

mantissas, 67

stack, 305

low-level I/O, 357, 387

math.h header file, 440

unions, 334, 425-426

mathematical functions,

arrow operator (->),

148

335, 351

cos(), 149-150

declaring, 334

M

pow(), 150-152

defining variables,

sin(), 149-150

334-335

macro body, 392, 396

sqrt(), 150-152

dot operator (.),

macro names, 392-393

tan(), 149-150

335-337, 351

macro substitution, 392

measuring

initializing, 337-339,

code example, 394-396

size

351

#define directive, 393

data, 122-123

memory sharing

macros

structures, 339-341

code example,

#define directive, 393

unions, 339-341

338-339

code example,

string lengths, 212-213

nesting, 343-346

394-396

members, structures, 314

referencing,

defining function-

assessing, 315

335-337, 351

like macros,

declaring, 314

referencing memory

394-396

referencing, 315-319

locations, 341-343,

expressions, 396

memory

352

nested macro defini-

addresses, 343

size, 339-341

tions, 396

allocated, releasing,

structures compari-

syntax, 393

283-286

son, 351

#if directive, 400

allocating

tag names, 334

#undef directive,

calloc() function,

variables, 176-177

393-394, 406

286-288

memory locations, tem-

va_arg(), 252

malloc() function,

porary, 229

va_start(), 252

280-283

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

520

Microsoft compiler

Microsoft compiler, 18-21

N

not equal to operator

running, 19

(!=), 98

starting, 18

null characters, 198-199

%n format specifier, 79

minimum field width

null pointers, 183

\n (newline character), 33

specifiers, 81-83

null statements, 112-113

named constants, versus

modes

numbers

numeric, 419

fopen() function,

binary, negatives, 142

named integer constants,

357-358, 388

decimal

declaring, 296

freopen() function,

converting to binary,

names

385-386

129-130

data types, 300-302

modifiers (variables),

converting to hex,

macro names, 392-393

234-235.
See also
data

79-81, 129-130

tag, unions, 334

modifiers

floating-point, calcula-

naming

modular programming,

tions, 152

built-in arguments, 308

419-420

negatives, 95

functions, 47, 418

modules, 419

scientific notation, 67

identifiers, 44

modulus operator (%),

numeric constants, ver-

variables, 68, 418

43

sus named, 419

negative numbers, 95,

moving

numeric values (of char-

142

file position indicators

acters)

nested block scope (vari-

fseek() function, 374

converting, 61

ables), 225-226

rewind() function,

showing, 63-64

nested comments, 31

378

nested conditional compi-

pointers, 260-262

lation, 402-404

multidimensional arrays

nested macro definitions

declaring, 199

O

(#define directives), 396

displaying, 200-201

nested structures

initializing, 199-201

%o (unsigned octal) for-

declaring, 327

multidimensional unsized

mat specifier, 79

listings, 327-329

arrays, 201-203

object files, 34

nesting

multiple pointers,

objects

if statements, 160-161

185-186

bit fields

loops, 116-117

multiplication assign-

code example,

unions

ment operator (*=), 93

348-350

code example,

multiplication operator

declaring, 347

344-345

(*), 182

defining, 347

in structures,

pointing to, 431-432

343-346

obtaining left values, list-

newline character (\n), 33

ing, 178

nibbles, 14

opening files (fopen()

nodes (linked lists),

function), 357-360, 381

adding, 414

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

performance, comments

521

opening comment marks,

conditional (:?),

writing, 75

29-30

135-136

printf() function,

operands, 92

decrement (—), 96-98

78-79

operators

deference (*), 182

putc() function,

address-of (&),

dot (.), 315-317

75-76

177-179, 323

unions, 335-337, 351

putchar() function,

arithmetic, 43-44

increment (++), 96-98

77-78

arithmetic assignment,

logical, 124

outputs, null characters,

92-95

AND (&&), 124-126

198-199

addition assignment

NEGATION (!),

overwriting data in stack,

(+=), 93

128-129

305

division assignment

OR (||), 126-127

(/=), 93

precedence, 98-99

multiplication

relational, 98-100

assignment (*=),

equal to (==), 98

P

93

greater than (>), 98

remainder assign-

greater than or equal

%p format specifier, 79,

ment (%=), 93

to (>=), 98

179

subtraction assign-

less than (<), 98

parameters, command-

ment (-=), 93

less than or equal to

line arguments, 305

array subscript ([ ]),

(<=), 98

parentheses

190

not equal to (!=), 98

if statement, 156

arrow (->), 324, 335,

sizeof, 122-123

placing around expres-

351

table of, 421-422

Other books

The Watchers by Shane Harris
Plans Change by Robin, Juli
Mage Quest - Wizard of Yurt 3 by C. Dale Brittain
B009QTK5QA EBOK by Shelby, Jeff
The Youngest One by Nancy Springer
The Man in 3B by Weber, Carl
Goat by Brad Land