Please read through and complete the participation exercises under the C++ for lab 1 (and more) section of the zyBook. You can skip “Try 3.3.1 that requires you to download RIMS for windows. Also finish up lab 0 if you haven’t completed it.
In this lecture you will:
By the end of this lecture you should be able to:
Pointers are special types that store the address of another variable, rather than the value of a variable
number
located at memory address 0, and I created a pointer to that location, I would have a pointer with value 0.Pointers used in lab 1 in two scenarios
int getNumber(int number, bool keyPad, char* operation, bool* negative);
pc.read(&buff,1);
&
is the address-of operator, and can be read simply as "address of"*
is the dereference operator, and can be read as "value pointed to by"declaring a pointer (* just means pointer, not dereference)
int * number;
char * character;
double * decimals;
Write a function that adds two integers and stores the result in an int passed to the function as a pointer: void addTwoNumbers(int num1, int num2, int * result);