Pointer changing variable in C.

 

01  #include<stdio.h>
02
03 int main()
04 {
05 int x=50; //integer variable
06
07 int *ptr; //integer pointer
08
09 printf("Value of X : %d n",x);
10
11 ptr= &x; // ptr points to 'x'
12
13 *ptr=100; // x=100
14
15 printf("Value of X : %d n",x);
16
17 return 0;
18 }
 
 OUTPUT :

Value of X : 50
Value of X : 100

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.