... | ... | @@ -18,6 +18,7 @@ |
|
|
1. [Braces and Comments](#11-braces-and-comments)
|
|
|
2. [When braces are needed](#12-when-braces-are-needed)
|
|
|
2. [Parentheses and spaces](#1-parentheses-and-spaces)
|
|
|
1. [Pointer/Reference Operator](#21-pointer-reference-operator)
|
|
|
|
|
|
----
|
|
|
|
... | ... | @@ -35,19 +36,30 @@ while (condition) { |
|
|
...
|
|
|
}
|
|
|
|
|
|
typedef struct my_struct_s {
|
|
|
…
|
|
|
} my_struct_t;
|
|
|
```
|
|
|
|
|
|
Note the special `switch` use-case:
|
|
|
|
|
|
```c
|
|
|
switch (a) {
|
|
|
case ‘c’:
|
|
|
…
|
|
|
break;
|
|
|
case ‘d’: {
|
|
|
…
|
|
|
break;
|
|
|
}
|
|
|
…
|
|
|
default:
|
|
|
…;
|
|
|
}
|
|
|
|
|
|
typedef struct my_struct_s {
|
|
|
…
|
|
|
} my_struct_t;
|
|
|
```
|
|
|
|
|
|
The `case X:` statements are indented within the switch block. The entire case block is indented.
|
|
|
|
|
|
This is also true for functions:
|
|
|
|
|
|
```c
|
... | ... | @@ -128,4 +140,13 @@ return 1; |
|
|
|
|
|
**Justification**
|
|
|
|
|
|
Keywords are not functions. By putting parentheses next to keywords and function names are made to look alike. |
|
|
\ No newline at end of file |
|
|
Keywords are not functions. By putting parentheses next to keywords and function names are made to look alike.
|
|
|
|
|
|
## 2.1. Pointer/Reference Operator ##
|
|
|
|
|
|
The pointer or reference operator (`*`, `&`, or `^`) is attached to the variable name.
|
|
|
|
|
|
```c
|
|
|
char x[3] = {0, 0, 0};
|
|
|
char *x_ptr = &x;
|
|
|
``` |
|
|
\ No newline at end of file |