C++

Objectives :

  • Pointer FAQ
  • Computer memory addressing
  • Pointer to Variables
    • defining pointer
      type *ptr1;
      int *ptr1;
    • Address operator or Reference Operator (&)
      int n1, age, var1;
      int *ptr1 = &n1; // pointing to the address of n1
      // when a pointer contains as address value, is also called as indirection operator
      age = &var1
    • deference pointer
      age = *n1
    • void pointers ( allowing exchange values between two data types;
       

Member access operators:
Dot operator (.) for structures and objects
Arrow operator (->) for pointers
Print member hour of timeObject:
cout << timeObject.hour;
OR
timePtr = &timeObject; //
cout << timePtr->hour;
timePtr->hour is the same as ( *timePtr ).hour
Parentheses required: * has lower precedence than .