home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / snip1292.zip / STORAGE.TYP < prev    next >
Text File  |  1991-09-20  |  2KB  |  79 lines

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