Sams Teach Yourself C in 24 Hours (76 page)

declaring.
See also
defin-

default keyword, 56

296

ing; prototyping

default values

float, 47, 64

functions

enum data types, 298

int, 46, 62

arrays, 190

integers, 296

names, 300-302

[ ] (brackets), 190

deference operator (*),

pointers, moving,

of pointers, 272

182

260-262

of structures,

#define directive, 296,

size, changing, 145-147

324-327

393, 434

sizes, measuring,

bit fields, 347-350

code example, 394-396

122-123

creating declarations,

defining function-like

struct, 424-425

299

macros, 394-396

bit fields, 347-350

definitions

expressions, 396

structures, 314

combining, 315

nested macro defini-

union, 425-426

compared, 244, 432

tions, 396

void, function declara-

enum data types, 296

syntax, 393

tions, 248-249

functions, 244-249

defining.
See also
declar-

DataDisplay() function,

prototypes, 245

ing

326, 346

specifying return

bit fields, 347-350

DataEnter() function,

types, 244

data types, variable

346

getchar() function, 248

lists, 424

DataRead() function,

global variables, 229

declarations

377, 381, 384

main() functions, 306

combining, 315

DataReceive() function,

members, structures,

compared, 244, 432

321

314

#define directive, 296,

DataWrite() function,

multidimensional

393, 434

381, 384

arrays, 199

code example,

date and time functions,

multidimensional

394-396

249

unsized arrays, 201

defining function-

dates, converting,

named integer con-

like macros,

250-251

stants, 296

394-396

daylight savings time,

nested structures, 327

expressions, 396

249

pointers, 180-181,

function-like macros,

debugging, 37

274-275

394-396

bugs, 420

structures, 314-315

nested macro defini-

checking syntax, 36

synonyms, 300

tions, 396

error messages, 36

unions, 334

syntax, 393

decimal numbers

unsized character

functions, 244-247

converting to binary,

arrays, 209

macros, #if directives,

129-130

variables, 48, 177, 244

400

converting to hex,

floating-point num-

structure variables, 315

79-81, 129-130

bers, 64-65

integers, 62-63

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

510

defining

synonyms, 321

displaying

enum data type, 296, 424

variable lists, enum data

arrays of characters,

declarations, 296

types, 296

196-198

declaring, 296

variables, 244

multidimensional

defining, listing, 297

enum data types, 296

arrays, 200-201

defining variables, 296

unions, 334-335

division, truncation, 100

integer values, assign-

dereferenced pointers,

division assignment oper-

ing, 296, 300

323

ator (/=), 93

listing, 298-299

directives (preprocessor)

do keyword, 56

values, 298-299

#define, 296, 393

do-while loops, 107-109

variable lists, 296

code example,

dot operator (.), 315-317

enum keyword, 56

394-396

unions, 335-337, 351

enumerated data type.

defining function-

double data type, 67

See
enum data type

like macros,

double keyword, 56

EOF (end-of-file) con-

394-396

double quotes (“), 32-33,

stant, 73

expressions, 396

59

equal to operator (==),

nested macro defini-

duplication, avoiding

98

tions, 396

(structures), 322

errno.h header file, 439

syntax, 393

durations (variables), 229

error messages, 36

#elif, 401-402

errors

#else, 399-402

compliancy (compilers),

#endif, 397-402, 406

280-281

code example,

E

pointers, uninitialized,

398-399

262

syntax, 397

%e (scientific notation)

escape character (\), 59

#if

format specifier, 67, 79

evaluating conditions, if

arithmetic expres-

elements (arrays),

statement, 156

sions, 406

190-192

.exe filename extension,

code example,

#elif directive, 401-402,

29

401-402

434

executable files, 24, 34-

macro definitions,

#else directive, 434

35, 318

400

code example, 401-402

executing

nested conditional

syntax, 399

codes, if statement, 156

compilation,

else keyword, 56

programs, 305

402-404

end-of-file (EOF), 73

statements, switch, 164

syntax, 399

#endif directive, 397-402,

exhausting stack

#ifdef, 397-399

406, 416

resources, 305

#ifndef, 397-399

code example, 398-399

exit() function, 34

#include, 31

syntax, 397

exiting switch statements,

#undef, 393-394, 406

ending outputs, null

164

disabling buffering, 387

characters, 198-199

exponents, 67

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

files

511

expressions, 42-43, 426.

file pointers, 357, 371

reading keyboard

See also
operators

file position indicators.

input, 366

arithmetic, 406

See
FILE structure

syntax, 363

conditional, switch

file scope (variables), 232

file pointers, 357, 371

statement, 161-162

file streams, 433

FILE structure, 357,

creating, 299

FILE structure, 357

374-375, 378

#define directive, 396

file position indicators,

fopen() function, 357,

in for loops, 113-115

357

381

macro body, 396

fseek() function, 374

code example,

placing parentheses

ftell() function, 375

359-360

around, 419

rewind() function,

formatting, 388

return values in, 47

378

modes, 357-358, 388

extern keyword, 56, 234

filename extensions,

opening files, 358

28-29

syntax, 357

files, 433

fputc() function,

binary

360-363

F

reading, 378-381

fputs() function,

writing, 378-381

364-366

%f (floating-point) for-

defined, 356

fread() function, 381

mat specifier, 65-67, 79

executable, 24, 34-35

code example,

\f (form-feed character),

fclose() function

368-369

60

closing files,

reading files,

fclose() function

358-360, 371

366-369

code example, 359-360

code example,

syntax, 366

files, closing, 358-360,

359-360

fseek() function,

371

syntax, 359

374-378

syntax, 359

feof() function, 367-369

ftell() function, 374-378

feof() function, 367

fgetc() function

fwrite() function, 381

code example, 368-369

code example,

code example,

syntax, 367

361-363

368-369

fgetc() function

reading files,

syntax, 367

code example, 361-363

360-363

writing files,

files, reading, 360-363

syntax, 361

366-369

syntax, 361

fgets() function

header, 32

fgets() function

code example,

ANSI, 439

code example, 364-366

364-366

stddef.h, 301

files, reading, 363-366

gets() function com-

stdio.h, 32

gets() function compari-

parison, 364-366,

stdlib.h, 302

son, 364-366, 371

371

string.h, 302

reading keyboard input,

reading files,

naming, case sensitivity,

366

363-366

32

syntax, 363

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

512

files

object, 34

format specifiers

fscanf() function

random access,

%%, 79

code example,

374-378, 387

%c (character), 60-62,

382-384

rewind() function, 378

79

scanf() function

code example,

%d (integer), 63-64, 79

comparison, 381

379-384

%e (scientific notation),

syntax, 381

syntax, 378

67, 79

formatting files, fopen(),

sequential access, 374

%f (floating-point),

388

source code, 34

65-67, 79

forms, switch statement,

streams comparison,

fprintf() function

161

356

adding h to, 147-148

fprintf() function

float data type, 47, 64

adding l to, 147-148

code example, 382-384

float keyword, 56

%G (uses %f or %E),

format specifiers

float.h header file, 439

79

adding h to, 147-148

floating data type.
See

%i (integer), 79

adding l to, 147-148

float data type

minimum field width,

printf() function com-

floating-point constants,

81-83

parison, 381, 388

423

%n, 79

syntax, 382

floating-point format

%o (unsigned octal), 79

fputc() function

specifier (%f), 65-67, 79

%p, 79

code example, 361-363

floating-point numbers,

precision specifiers,

files, writing, 360-363

64

84-85

syntax, 361

calculations, 152

printf() function, 78-79

fputs() function

declaring, 64-65

adding h to, 147-148

code example, 364-366

flushing buffers, 356

adding l to, 147-148

files, writing, 363-366

fopen() function, 381

%p, 179

puts() function compar-

code example, 359-360

%s, 217

ison, 364

files, opening, 357-358

%s (string), 79

syntax, 364

formatting new files,

scanf() function, 217

fread() function

388

%u (unsigned integer),

binary files, 381

modes, 357-358, 388

79

code example, 368-369

syntax, 357

%X (unsigned hexadec-

files, reading, 366-369

for keyword, 56

imal), 79

syntax, 366

for loops, 109-112

formatted data

fRecur() recursive func-

complex expressions in,

fprintf() function

tion, 304

113-115

code example,

free() function, 283-286

infinite, 166

382-384

freopen() function

null statements,

printf() function

code example, 385-386

112-113

comparison, 381,

modes, 385-386

form-feed character (\f),

388

streams, redirecting,

60

syntax, 382

384-388

syntax, 384

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

functions

513

fscanf() function

defining, 245-247, 432

fprintf()

code example, 382-384

ending, 48

code example,

scanf() function com-

exit(), 34

382-384

parison, 381

fclose()

printf() function

syntax, 381

Other books

The Wonder Garden by Lauren Acampora
Chase Wheeler's Woman by Charlene Sands
The Story of an Hour by Kate Chopin
Almost Innocent by Carina Adams
Crave: A BWWM Romance by Sadie Black
Ten Little Wizards: A Lord Darcy Novel by Michael Kurland, Randall Garrett
Mesmerized by Audra Cole, Bella Love-Wins


readsbookonline.com Copyright 2016 - 2024