#coding #programming #cprogramming
void birthday(int* age);
int main() {
// pointer = A variable that stores the memory address of another variable.
// Benefit: They help avoid wasting memory by allowing you to pass
// the address of a large data structure instead of copying the entire data.
int age = 25;
int *pAge = &age;
birthday(pAge);
printf("You are %d years old", age);
return 0;
}
void birthday(int* age){
// pass by reference
(*age)++;
}
Continue this lesson in the app
Install CourseHive on Android or iOS to keep learning while you move.