Chapter
Passing By Reference
From ComputerScienceOne by Dr Chris Bourke
Concepts
- How can you check for a NULL pointer and dereference a valid pointer?
"Pointers NULL using the usual equality operator.\n\n1 int *ptrA = NULL;\n\n2 ...\n\n3 if(ptrA == NULL) {\n\n4 printf(\"Error: invalid memory location\n\n\");\n\n5 }\n\nDereferencing Operator\n\nOnce
- How can pointers be used to pass variables by reference?
"Now that we have the ability to reference a memory location using pointers, we can write functions that pass variables by reference. To do so, we use the same asterisk syntax used with pointer variab
- How do you invoke functions that accept pointer parameters?
"To invoke these functions, we need to pass pointers to the functions appropriately. We could do this by creating pointer variables or using the referencing operator directly.\n\n1 int x = 10;\n\n2 in