summaryrefslogtreecommitdiff
path: root/reference/C/CONTRIB/SNIP/storage.typ
blob: 120311288bf980fb1841ec8357ca4ee5484e89e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
                        STORAGE TYPES

        A C language crib sheet from Jeff Galbraith


int x;
 - x is an int.

int *x;
 - x is a pointer to an int.

int **x;
 - x is a pointer to a pointer to an int.

const int x;
 - x is a const int (constant integer).

const int *x;
 - x is a pointer to a const int. The value of x may change, but
   the integer that it points to not be changed. In other words,
   x cannot be used to alter the value to which it points.

int *const x;
 - x is a constant pointer to an int. The value may not change,
   but the integer that it points to may change. In other words,
   x will always point at the same location, but the contents may
   vary.

const int *const x;
 - x is a constant pointer to a constant integer. The value of x
   may not change, and the integer that it points to may not
   change. In other words, x will always point at the same
   location, which cannot be modified via x.

int x[];
 - x is an array of int.

int x[99];
 - x is an array of 99 int's.

int *x[];
 - x is an array of pointers to int.

int (*x)[];
 - x is a pointer to an array of int.

int *(*x)[];
 - x is a pointer to an array of pointers to int.

int F();
 - F is a function returning int.

int *F();
 - F is a function returning a pointer to int.

int (*x)();
 - x is a pointer to a function returning int.

int (*x[99])();
 - x is an array of 99 pointers to functions returning int.

int (*F())();
 - F is a function returning a pointer to a function returning int.

int *(*F())();
 - F is a function returning a pointer to a function returning a
   pointer to an int.

int (*F())[];
 - F is a function returning a pointer to an array of int.

int (*(*F())[])();
 - F is a function returning a pointer to an array of pointers to
   functions returning int.

int *(*(*F())[])();
 - F is a function returning a pointer to an array of pointers to
   functions returning a pointer to int.