Table of Contents

data Keyword 1

Null Pointers

Definition

A Null pointer is a pointer that points definitivly nowhere. it does not yield the address of any object or function.

malloc for instance returns a null pointer when it fails.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

data Keyword 1 Phase 2

passing by reference (function parameter passing) [C++]

Definition

To use the address of a variable as a reference to some sort of data contained in the variable to send to some algorithmic function which can use the variable's data to perform some sort of action or solve a problem.

References

Demonstration

Demonstration of the indicated keyword.

The code block below demonstrates the concept defined above.

  1 #include <stdio.h>                                                                                           
  2 #include <stdlib.h>
  3 
  4 int Sum(int, int);
  5 
  6 int main()
  7 {
  8     int a;
  9     int b;
 10     int S;
 11 
 12     printf("please enter two values you would like to add together.\n");
 13 
 14     scanf("%d", &a);
 15     scanf("%d", &b);
 16 
 17     Sum(a, b);
 18 
 19     printf("\nThe sum of a and b is %d.\n", Sum(a, b));
 20     return 0;
 21 }
 22 
 23 int Sum(int a, int b)
 24 {
 25 
 26     int S;
 27 
 28     S = a + b;
 29     return (S);
 30 }