Skip to content

Commit e3760f5

Browse files
authored
Update C_syntax.md
1 parent 106e3fe commit e3760f5

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

LearningC/C_Language_Shorts/C_syntax.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,18 @@ When you want to create a function you put the prototype at the beginning of the
261261
> return <return-value>;
262262
> }; // note the semi-colon
263263
> ```
264-
>
264+
> example:
265+
> > in header
266+
> > ```
267+
> > float norm(float x, float y);
268+
> > ```
269+
> > in source
270+
> > ```
271+
> > float norm(float x, float y){
272+
> > return sqrt(x*x + y*y);
273+
> > }
274+
> >```
275+
>
265276
266277
> [!TIP]
267278
> **main** from the _main program_ is the **main function** \
@@ -288,17 +299,17 @@ Conditional statements are only executed under certain conditions\
288299
### switch-case
289300
```
290301
switch (<test>):
291-
case (confition1):
302+
case (result A):
292303
...
293304
break;
294-
case (confition2):
305+
case (result B):
295306
...
296307
break;
297-
case (confition3):
308+
case (result C):
298309
...
299310
break;
300311
...
301-
default:
312+
default: // unexpected or obvious
302313
...
303314
break;
304315
```

0 commit comments

Comments
 (0)