Pointers and Basic Structures in C++


Terms

Pointer  -  A variable that holds an address, or location in memory.
Address  -  A location in the computer's memory.
Pass by Value  -  The process by which a function receives a copy of a variable; the variable's value in the caller cannot be changed by the called function.
Pass by Reference  -  Passing by reference means passing a variable's address to a function. By defining a function that accepts pointers, one gains the ability to change the parameter's value in the calling function (ie. outside the scope of the current function).
Struct  -  A struct is a structure that groups together related variables, thus forming a new data type.
NULL  -  A special pointer value that indicates that the pointer does not refer to a valid location in memory.
New  -  The new operator tells the C++ compiler to allocate a space in memory that will host the specified variable type.
Delete  -  The delete operator frees memory allocated with new.
Array  -  An array is a basic data structure with a fixed number of elements. Arrays allow fast access to their elements using bracket notation.
Index  -  The index of an array element is the element's number in the array. Indices begin at 0, so an array of size n will have indices from 0 to n - 1.
Element  -  An element of an array is one of the values that the array holds.

Take a Study Break

SparkLife

Star Trek gets SEXY

Chris Pine and Zoe Saldana heat up the red carpet!

SparkLife

Are you afraid of relationships?

Auntie SparkNotes can help!

SparkLife

Wanna get JLaw's gorgeous glow?

Click here for simple, sexy makeup tricks!

SparkLife

Sexy starlet style

See every single look from the Met Gala!

SparkLife

Who'd be on your zombie-apocalypse crew?

We already dib'sed Genghis Khan.

Geek out!

The MindHut

Geeky Actors: Then and Now

Travel back in time!

The MindHut

Villains We Want These Actresses to Play

From super cute to super bad!

The MindHut

10 Movies Better Than Their Books

What do you think?

The MindHut

How To Look Like J-Law...

When you don't look like J-Law.

The MindHut

12 Scientific Inaccuracies in Into Darkness

What did Star Trek get wrong?