Initialize the pointer with the other (normal variable whose value we have to modify) variable's address
Update the value
Program:
#include <stdio.h>
int main(void) {
int num = 10;
//declaring and initializing the pointer
int *ptr = #
printf("value of num: %d\n", num);
printf("value of num: (using pointer): %d\n", *ptr);
//updating the value
*ptr = 20;
printf("value of num: %d\n", num);
printf("value of num (using pointer): %d\n", *ptr);
return 0;
}
Output
value of num: 10
value of num: (using pointer): 10
value of num: 20
value of num (using pointer): 20
Steps:
Program:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer