Outline for May 17, 2002

Handouts: none
Reading: Johnsonbaugh and Kalin, pp. 390-435, 679-702 (appendix of useful functions)

  1. Greetings and felicitations!
  2. Other Types
    1. bit fields
    2. unions
    3. enumerated types
  3. Libraries
    1. compiling with libraries
    2. common libraries: stdio, ctype
  4. Standard I/O Library (#include <stdio.h>)
    1. open file: fopen
    2. unstructured read/write: getchar, fgetc (getc), putchar, fputc (putc)
    3. formatted read/write: fgets (gets), fscanf, fputs (puts), fprintf
    4. structured read/write: fread, fwrite
    5. random access: fseek, ftell, rewind
    6. close file: fclose
    7. miscellaneous: feof, ferror, clearerr
  5. Character types and conversions (#include <ctype.h>)
    1. alphabetics, numerics, alphanumerics: isalnum, ialdigit, isxdigit, isalpha
    2. ypper, lower, and conversions: isupper, islower, toupper, tolower
    3. types of chars: iscntrl, isgraph (not blank, printable), isprint (printable), ispunct, isspace
  6. String conversion (#include <stdlib.h>)
    1. string to number: atoi, atof, atol
  7. String functions (#include <string.h>)
    1. compare: strcmp, strncmp, strcasecmp, strncasecmp; memcmp
    2. copy: strcpy, strncpy; memcpy (no overlap), memmove (overlap okay)
    3. find character: strchr (index), strrchr (rindex), strpbrk; memchr
    4. length: strlen
  8. Memory management (#include <stdlib.h>
    1. Allocation: malloc, calloc
    2. Release: free, cfree (deprecated)
    3. Reallocation: realloc()
  9. Miscellaneous
    1. terminate program (exit); include <stdlib.h>
    2. sort array of data (qsort); include <stdlib.h>
    3. time of day (time, ctime); include <time.h>
    4. execute cvommand (system); include <stdlib.h>

ECS 30-A, Introduction to Programming
Spring Quarter 2002
Email: cs30a@cs.ucdavis.edu