How to declare and initialize a pointer
How to pass primitive data types by reference to a function.
How the dereferencing (indirection) operator is used
Explore the following update to cubePass By Reference
void cubePass2(int * const numberPtr) {
printf (* *numberPtr = %d\n", "numberPtr);
printf ("numberPtr = %p\n", numberPtr);
int cube = (*numberPtr) * (*numberPtr) * (*numberPtr);
*numberPtr = cube;
numberPtr = &cube;
printf (* *numberPtr = %d\n\n", *numberPtr);
}
What do you think the const qualifier means when used in declaring the pointer in the
parameter above?
What principle needs to be applied when passing primitive data types by reference?
What happens when you do the following?
void func(const int * numberPtr)
void func(const int * const numberPtr)
Review Lecture 14. Add the following array to main and the necessary symbolic constant for
the array size.
const char *surveyCategories [RENTER_SURVEY_CATEGORIES] = {"Check-in Process",
"Cleanliness", "Amenities"};
Explain the declaration and initialization and what is stored in the surveyCategories array.
Write a function to display the categories.
Fig: 1