/*To test what happens when int is converted to void *   
  The idea is that it lets because pointer is nothing but an address and it is
  stored as an int 
*/

#include <stdio.h>

int main(){
  int i = -1;
  printf("%d\n",i);
  void * ptr = (void *)i; //ptr stores the value of i as address
  int k = (int)ptr; //value is restored
  
  //update the pointer by 1
  ptr++;
  int j = (int)ptr; //printf the approriate increment
  printf("%d\n",j);
  
  
  //OTHER THINGS TO TRY - uncomment one by one
  
  /*This can segment if the address i.e.value of pointer is 
    illegal address for user
    int * b = (int *)ptr; 
    printf("%d\n",*b);
  */
  

  /* Compiler does not like its double cast to pointer...
     because of loss of precision (actually a good thing)
     
     double d = 2.15;
     void * ptr2 = (void *)d;
  */   
  return 0;
}
