#include <stdio.h>
int main(void) {
// Declare an integer and a pointer to it
int num = 5;
int *ptr = #
// Print the address of the integer and the value of the pointer
printf("Address of num: %p\n", &num);
printf("Value of ptr: %p\n", ptr);
return 0;
}
This program declares an integer called num
and a pointer to it called ptr
. It then prints the address of num
using the &
operator, and the value of ptr
.
Here is an example of the output of this program:
Address of num: 0x7ffeeb4987fc
Value of ptr: 0x7ffeeb4987fc
0 Comments