07-25-2023, 11:42 AM
Pointers can be passed to functions to modify the original data.
void increment(int *num) {
(*num)++;
}
int main() {
int x = 5;
increment(&x);
printf("x: %d\n", x); // Output: 6
return 0;
}
void increment(int *num) {
(*num)++;
}
int main() {
int x = 5;
increment(&x);
printf("x: %d\n", x); // Output: 6
return 0;
}
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos