home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_05 / 9n05071a < prev    next >
Text File  |  1991-03-04  |  412b  |  27 lines

  1.  
  2. /* CUJ example, Stephen D. Williams, SDW Systems */
  3. #include <stdio.h>
  4. main()
  5.  {
  6.  char *ptr = "hi there george";
  7.  
  8.  puts(ptr);
  9.  
  10.  /*  ((long *)&ptr)++; <---incorrect */
  11.  
  12.  (*((long**)&ptr))++;
  13.  puts(ptr);
  14.  
  15. #define ptr_type(type, prt) (*((type**)&ptr))
  16.  puts((char *)++(ptr_type(long,ptr)));
  17. #undef ptr_type /* scoped macro*/
  18.  }
  19.    
  20. /* 
  21. output:
  22. hi there george
  23. here george
  24.  george
  25. */
  26.  
  27.