forked from gouravthakur39/beginners-C-program-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointers.c
More file actions
26 lines (21 loc) · 741 Bytes
/
Pointers.c
File metadata and controls
26 lines (21 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Handling of pointers in C program
// Pointers in C language is a variable that stores/points the address of another variable.
// A Pointer in C is used to allocate memory dynamically i.e. at run time.
#include <stdio.h>
int main() {
int * pc; // * is used to make pointer
int c;
c = 22;
printf("Address of c: %u\n", & c);
printf("Value of c: %d\n\n", c);
pc = & c;
printf("Address of pointer pc: %u\n", pc);
printf("Content of pointer pc: %d\n\n", * pc);
c = 11;
printf("Address of pointer pc: %u\n", pc);
printf("Content of pointer pc: %d\n\n", * pc);
* pc = 2;
printf("Address of c: %u\n", & c);
printf("Value of c: %d\n\n", c);
return 0;
}