Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a8e2fce

Browse files
authored
Merge pull request #173 from cs50/curiouskiwi-patch-c-style
Update c.md
2 parents ff6d781 + 1594d77 commit a8e2fce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

style/c.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Notice how:
158158

159159
## Functions
160160

161-
In accordance with [C99](http://en.wikipedia.org/wiki/C99), be sure to declare `main` with:
161+
In accordance with [C11](https://en.wikipedia.org/wiki/C11_(C_standard_revision)), be sure to declare `main` with:
162162

163163
```c
164164
int main(void)
@@ -227,7 +227,7 @@ As for your own functions, be sure to define them similarly, with each curly bra
227227

228228
## Indentation
229229

230-
Indent your code four spaces at a time to make clear which blocks of code are inside of others. If you use your keyboard's Tab key to do so, be sure that your text editor's configured to convert tabs (`\t`) to four spaces, else your code may not print or display properly on someone else's computer, since `\t` renders differently in different editors. (If using [CS50 IDE](https://ide.cs50.io/), it's fine to use Tab for indentation, rather than hitting your keyboard's space bar repeatedly, since we've preconfigured it to convert `\t` to four spaces.)
230+
Indent your code four spaces at a time to make clear which blocks of code are inside of others. If you use your keyboard's Tab key to do so, be sure that your text editor's configured to convert tabs (`\t`) to four spaces, else your code may not print or display properly on someone else's computer, since `\t` renders differently in different editors. (If using [cs50.dev](https://cs50.dev/), it's fine to use Tab for indentation, rather than hitting your keyboard's space bar repeatedly, since we've preconfigured it to convert `\t` to four spaces.)
231231

232232
Here's some nicely indented code:
233233

@@ -318,7 +318,7 @@ int* p;
318318

319319
## Variables
320320

321-
Because CS50 uses [C99](http://en.wikipedia.org/wiki/C99), do not define all of your variables at the very top of your functions but, rather, when and where you actually need them. Moreover, scope your variables as tightly as possible. For instance, if `i` is only needed for the sake of a loop, declare `i` within the loop itself:
321+
Because CS50 uses [C11](https://en.wikipedia.org/wiki/C11_(C_standard_revision)), do not define all of your variables at the very top of your functions but, rather, when and where you actually need them. Moreover, scope your variables as tightly as possible. For instance, if `i` is only needed for the sake of a loop, declare `i` within the loop itself:
322322

323323
```c
324324
for (int i = 0; i < LIMIT; i++)

0 commit comments

Comments
 (0)