Jump to page content Jump to navigation

College Board

AP Central

AP Course Audit Web Site
Click for more information about College Board Online Events


Siemens Awards for Advanced Placement
Print Page
Home > The Courses > Course Home Pages > The C++ Subset: Properties of Language

The C++ Subset: Properties of Language

Last Updated: 8/17/00
A and AB course AB course only Comment

Properties of Language


Understand short circuit evaluation. Boolean expressions such as (a && b) are evaluated left-to-right; expression evaluation stops when the value of the entire expression can be determined. This means that contructs such as
while (k < n && a[k] != key)
can be used safely.
Use built-in types: int, char, double, bool. For compilers that do not use 32 bit integers, long int may be used, otherwise no modifiers short, long, signed, unsigned.
Read and use enum.
Use operators
+, -, *, /, %;
++, --;
&&, ||, !;
==, <, >, !=, <=, >=;
=, +=, -=, *=, %=, /=; and
insertion extraction for I/O <<, >>.
Use ++ and -- only as shorthand for +=1 and -=1; do NOT use these operators in expressions like a[k++] = 0.
Use break. Used in switch statements, can be used in loops. The continue statement will not be tested.
Use function syntax for typecasts, e.g., cout << double(x)/3. For some types, e.g., long int, another form of cast is necessary: (long int) x. When compilers support the static_cast <> operator it will be used.
Use pointers: operators *, ->, new, delete; NULL preferred to 0; use == and != with pointers. The address of operator & is used to test for aliasing in operator=, but not used elsewhere. Pointer arithmetic, pointers to functions, and pointer comparison using < and > will NOT be tested.
Use [ ][ ] in matrix class for indexing. Reinforce vector of vectors and mimic notation for built-in arrays.
Use #include and #ifndef idiom in header files. No other use of preprocessor; const variables used instead of #define.
Use escape sequences, \n, \t, \\, \',\"
Use value, reference, and const reference parameters.
Recognize that values returned by operator [ ] for string and vector can be assigned to, e.g., s[0] = 'a' is allowed. Read and use reference return types and understand the implications of returning reference to local variable. No testing of reference return types for AP CS A students.
Use the functions fabs, pow and sqrt from <math.h>.
Use constants INT_MAX, INT_MIN from <limits.h>






  MY AP CENTRAL
    Course and Email Newsletter Preferences
  AP COURSES AND EXAMS
    Course Home Pages
    Course Descriptions
    The Course Audit
    Sample Syllabi
    Teachers' Resources
    Exam Calendar and Fees
    Exam Questions
    AP Credit Policy Information
  PRE-AP
    Teachers' Corner
    Publications
  AP COMMUNITY
    About Electronic Discussion Groups
    Become an AP Exam Reader

Back to top