pointer
This commit is contained in:
19
w3resource/pointers/e1-1.c
Normal file
19
w3resource/pointers/e1-1.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int m = 10;
|
||||
int *z = &m;
|
||||
int n, o;
|
||||
|
||||
printf("\n\n Pointer : Show the basic declaration of pointer :\n");
|
||||
printf("-------------------------------------------------------\n");
|
||||
printf(" Here is m=10, n and o are two integer variable and *z is an integer");
|
||||
printf("\n\n z stores the address of m = %p\n", z); // Printing the address stored in z using %p
|
||||
printf("\n *z stores the value of m = %i\n", *z); // Printing the value pointed to by z using *z
|
||||
printf("\n &m is the address of m = %p\n", &m); // Printing the address of m using &m
|
||||
printf("\n &n stores the address of n = %p\n", &n); // Printing the address of n using &n
|
||||
printf("\n &o stores the address of o = %p\n", &o); // Printing the address of o using &o
|
||||
printf("\n &z stores the address of z = %p\n\n", &z); // Printing the address of z using &z
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user