home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / STORAGE.TYP < prev    next >
Text File  |  1997-07-05  |  2KB  |  81 lines

  1. +++Date last modified: 05-Jul-1997
  2.  
  3.                         STORAGE TYPES
  4.  
  5.         A C language crib sheet from Jeff Galbraith
  6.  
  7.  
  8. int x;
  9.  - x is an int.
  10.  
  11. int *x;
  12.  - x is a pointer to an int.
  13.  
  14. int **x;
  15.  - x is a pointer to a pointer to an int.
  16.  
  17. const int x;
  18.  - x is a const int (constant integer).
  19.  
  20. const int *x;
  21.  - x is a pointer to a const int. The value of x may change, but
  22.    the integer that it points to not be changed. In other words,
  23.    x cannot be used to alter the value to which it points.
  24.  
  25. int *const x;
  26.  - x is a constant pointer to an int. The value may not change,
  27.    but the integer that it points to may change. In other words,
  28.    x will always point at the same location, but the contents may
  29.    vary.
  30.  
  31. const int *const x;
  32.  - x is a constant pointer to a constant integer. The value of x
  33.    may not change, and the integer that it points to may not
  34.    change. In other words, x will always point at the same
  35.    location, which cannot be modified via x.
  36.  
  37. int x[];
  38.  - x is an array of int.
  39.  
  40. int x[99];
  41.  - x is an array of 99 int's.
  42.  
  43. int *x[];
  44.  - x is an array of pointers to int.
  45.  
  46. int (*x)[];
  47.  - x is a pointer to an array of int.
  48.  
  49. int *(*x)[];
  50.  - x is a pointer to an array of pointers to int.
  51.  
  52. int F();
  53.  - F is a function returning int.
  54.  
  55. int *F();
  56.  - F is a function returning a pointer to int.
  57.  
  58. int (*x)();
  59.  - x is a pointer to a function returning int.
  60.  
  61. int (*x[99])();
  62.  - x is an array of 99 pointers to functions returning int.
  63.  
  64. int (*F())();
  65.  - F is a function returning a pointer to a function returning int.
  66.  
  67. int *(*F())();
  68.  - F is a function returning a pointer to a function returning a
  69.    pointer to an int.
  70.  
  71. int (*F())[];
  72.  - F is a function returning a pointer to an array of int.
  73.  
  74. int (*(*F())[])();
  75.  - F is a function returning a pointer to an array of pointers to
  76.    functions returning int.
  77.  
  78. int *(*(*F())[])();
  79.  - F is a function returning a pointer to an array of pointers to
  80.    functions returning a pointer to int.
  81.