------------------------------------------------------------------------------
MC logo
Arrays and Pointers
[^] CSc 220 Home
------------------------------------------------------------------------------
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[Array Echo] [Basic Pointers] [Swap Using Pointers] [Arrays and Pointers] [Array Passing] [Integer Select Sort] [Integer Quick Sort] [Integer Library Sort] [Pointers and References]
Reading: Pp. 48–49, 53–57, 221–231, 235–239

Like Java arrays, C/C++ arrays contain data selected (subscripted) by integer values. The smallest subscript is zero, and the largest is one less than the size. That's about all the similarities to Java. Here are some differences.

  1. C arrays may be allocated in several ways, none of them exactly like Java.
  2. C arrays are intimately related to pointers.
  3. Java checks that subscripts are in range and throws an exception if not. C completes the operation without checks, and results are unpredictable.