SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to print address of variable using pointer
C program to print address of variable using pointer
Output:
The address of variable a which is stored in pointer p is bff872cc
Implementation:
/* The pointers are created using syntax: datatype *pointer_name; here, the pointer_name could be assigned an address of another variable for example: int a=10; int *ptr; ptr=&a; Here, ptr is a pointer to an integer, which is supposed to store the address of an integer variable a is an integer variable initialized with a value 10 Now, ptr - holds the address of variable a &a - holds the address of variable a a - holds the value 10 *ptr - prints the value stored in a currently */ #include
int main(void) { int *p; int a=10; p=&a; printf("The address of variable a which is stored in pointer p is %x\n",p); return 0; }
PREVIOUS
NEXT
HOME