Skip to content

Commit 73688e9

Browse files
author
Colin Robertson
authored
Merge pull request #3377 from workingjubilee/patch-3
Clarify int main(void) example
2 parents fec0b85 + 6833fee commit 73688e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/c-language/c-bit-fields.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,24 @@ Bit fields defined as **`int`** are treated as **`signed`**. A Microsoft extensi
4848

4949
Bit fields are allocated within an integer from least-significant to most-significant bit. In the following code
5050

51-
```
51+
```C
5252
struct mybitfields
5353
{
5454
unsigned short a : 4;
5555
unsigned short b : 5;
5656
unsigned short c : 7;
5757
} test;
5858

59-
int main( void );
59+
int main( void )
6060
{
6161
test.a = 2;
6262
test.b = 31;
6363
test.c = 0;
64+
return 0;
6465
}
6566
```
6667
67-
the bits would be arranged as follows:
68+
the bits of `test` would be arranged as follows:
6869
6970
```
7071
00000001 11110010

0 commit comments

Comments
 (0)