You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
470 B
C

#include <stdio.h>
int main(void){
int x;
int *p;
/* Read it, "assign the address of x to p" */
p = &x;
printf("This should be random: %d\n", *p);
printf("Ok the address of x is %p\n", &x);
printf("Check that p has the same value: %p\n\n", p);
printf("Ok let's put a value in the pointer. Give me an int: \n");
scanf("%d", p);
printf("The value you provided was %d\n", *p);
printf("Let's check x since p was a pointer to x's memory address: %d\n", x);
}