ICT 9

Cards (20)

  • Array
    Collection of elements with the same data type
  • Array
    • Statically allocated from the stock: static arrays have their size fixed
  • Bounds Checking

    Checking if array index is within valid range
  • Garbage Value

    Calling out an invalid value that is not declared in the index
  • RAM
    Random access memory where the data that the processor is currently using is stored
  • Errors
    • Logical error
    • Syntax error
    • Run time error
    • Segmentation error
    • Compilation error
  • Logical error

    Instructions do not meet the goal, leads to incorrect results
  • Syntax error

    Error in the syntax of a code, programmer must fix it before compiling the program
  • Run time error
    Uninitialised element
  • Segmentation error

    Outside the bound of an array
  • Compilation error

    Error in compile time, typo error (e.g. missing ; or " or {)
  • Loops
    1. For loop - transverse through elements
    2. Nested for - traversing, for loop within a for loop
  • String Functions
    • strlen() - find length of string
    • strcmp() - compare string lexicographically
    • strcat() - concatenate 2 strings, add two strings
    • strcpy() - copy string
  • If you want to update, use "assign"
  • Logically, the index of an array cannot be negative
  • You can function an array
  • The default value of a garbage value is not always zero
  • You cannot change/resize an array during runtime
  • When declaring a string, use "character"
  • If there is only one element, the number of elements can be left blank []