07-25-2023, 11:41 AM
Pointers are variables that store memory addresses.
int num = 10;
int *ptr; // Declare a pointer
ptr = # // Assign the address of num to the pointer
printf("Value of num: %d\n", num); // Output: 10
printf("Address of num: %p\n", &num); // Output: Address in hexadecimal format
printf("Value of ptr: %p\n", ptr); // Output: Address of num
int num = 10;
int *ptr; // Declare a pointer
ptr = # // Assign the address of num to the pointer
printf("Value of num: %d\n", num); // Output: 10
printf("Address of num: %p\n", &num); // Output: Address in hexadecimal format
printf("Value of ptr: %p\n", ptr); // Output: Address of num
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