Skip to content

Commit

Permalink
added pointer access
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaanilkumar committed Jun 29, 2020
1 parent f6b6f57 commit 5752e6a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions C/poniter_access.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//pointer access - example

#include<stdio.h>
void main()
{
int x, y;
int *ptr;
x = 10;
ptr = &x;
y = *ptr;
printf("Value of x is %d\n\n",x);
printf("x is stored at addr %u\n", &x);
printf("y is stored at addr %u\n", &y);
printf("value of y is: %d\n",y);
printf("pointer variable ptr contains the addr %u\n", ptr);
printf("pointer variable ptr itself is stored at addr %u\n", &ptr);
*ptr = 25;
printf("\nNow x has been assigned a new value through pointer which is= %d\n",x);
}

0 comments on commit 5752e6a

Please sign in to comment.