POINTER Examples






#include <stdio.h>

void main()
{
   int number = 0;      
   int *pointer = NULL; /* A pointer that can point to type int     */

   number = 10;                     
   printf("\n number's address: %p", &number);   
   printf("\n number's value: %d\n\n", number);  
   pointer = &number;     /* Store the address of number in pointer   */

   printf("pointer's address: %p", &pointer);   /* Output the address */
   printf("\npointer's size: %d bytes", sizeof(pointer));  /* Output the size   */
   printf("\npointer's value: %p", pointer);   /* Output the value (an address) */  
   printf("\nvalue pointed to: %d\n", *pointer);        /* Value at the address */
}


           
       
OUTPUT :
A simple program using pointers

No comments: