1/7
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
const
keyword is a way to declare that a variable's value will not change
const keyword can also be used for function parameters to indicate
that a
function promises not to change a value
• Allows for clearer documentation of the implementation of a function
• Allows programmers to assume a function won't change a variable's value
int * const p = &h2g2; means
p always points to &h2g2
const int *p = &h2g2; means
p points to a const int
const int * const p = &h2g2;
p always points to a const int
clockwise or spiral rule to convert a declaration to a sentence
1.Take the name of the variable: "var is"
2. Replace [X] with "array X of" (or
replace [] "array undefined size of"
3. Replace function parameters (type1,
type2) with "function passing type1
and type2 returning..."
4. Replace * with "pointer(s) to"
5. Replace const with "constant"
use the clockwards spiral rule to turn this into a sentence: char * str[10]
str is an array 10 of pointers to a char
const int * const d;
d is a constant pointer to an int constant