Skip over navigation

Why Use Pointers?

Terms

Introduction and Summary

Void Pointers & Casting

Argument  -  Arguments are the data a function takes as input. For example, if I were to call a function steve(name, age) where name was declared as char *name and age were declared as int age, name and age would be the arguments to the function steve.
Bubble Sort Algorithm  -  A basic sorting algorithm used to put data in order where the larger data elements bubble up to the top, giving the algorithm its name. For more information on sorting, please refer to the SparkNote on the subject.
Cast  -  A cast is a conversion from one data type to another. There are two types of casts: explicit and implicit. Explicit casts are ones done because the programmer has said to do so. For example, in the code

int steve;
char spark;
steve = (int) spark;
the character variable spark is being cast to an integer before being stored into the variable steve. Implicit casts, on the other hand, are done without programmer intervention because the computer assumes that the cast needs to be made. For example, in the following code

int steve;
char spark;
steve = spark;
an implicit cast is performed to convert the character spark into the integer steve before the copy operation can be performed.
Dynamic Memory  -  When an application needs more memory while it is running, it can ask the operating system for access to however much it requires. This process is known as dynamic memory allocation.
Error Detection  -  When an error occurs in a program, the program needs to be able to handle the situation and resolve the problem in a reasonable manner. In order for the program to know how to handle dangerous situations (such as when it asks the operating system for more memory and for some reason the operating system cannot comply), the programmer has to tell it how to detect these errors, a process known as error detection.
Passing by Reference  -  When data is passed into a function as arguments, the function actually receives a copy of the original data, not the original data itself. Thus, if the function makes any changes to the data passed into it, the original data remains unaffected. In order for a function to be able to modify the arguments passed to it, the data needs to be passed by reference, meaning that instead of passing in a copy of the data, a pointer to the data is passed. The function can then modify what the data at the addresses given to it, resulting in the original variables being modified.
Static Memory  -  Static memory is memory given to a program in order to house variables the program has declared.

Follow Us