Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevfullstack authored Jul 28, 2024
1 parent 725e756 commit d6047cc
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,12 @@ As you can see here, it's just printing "Hello World" ten times, whether it's
a `for` loop, `while` loop, or `do-while` loop.

## Functions
A function is a group of statements (commands)
that together perform a task.
There are built-in functions and functions that a
programmer will create according to his/her needs.
A function is a group of statements (commands) that together perform a task.
There are built-in functions and functions that a programmer will create
according to his/her needs.

### Sample Program Creating And Using Functions
```
```c
#include <stdio.h>

void myFunction() {
Expand All @@ -420,31 +419,25 @@ void myFunction() {
}

int main() {
myFunction();
return 0;
}
```

The function `printFunctionTest()` is created by
declaring `void` first. Other functions will return values
but for the sake of simplicity we create a void `function`.
A `void` function will simply execute the commands
contained in it, nothing else.
The function `myFunction()` is created by declaring `void` first. Other
functions will return values, but for simplicity, we create a void function.
A `void` function will simply execute the commands contained in it, nothing
else.

Then inside the main function, you simply invoke it
by its name. And all the commands inside that function
will be executed line by line.
Then inside the main function, you simply invoke it by its name. All the
commands inside that function will be executed line by line.

Why use functions? Imagine if there is none. Complex
programs are usually composed of thousands of lines of code
up to million, without any grouping, that will be
very hard to handle.
Why use functions? Imagine if there were none. Complex programs are usually
composed of thousands to millions of lines of code. Without any grouping,
that would be very hard to handle.

If a function is generic and can be used for other
projects, you can simply separate it for distribution.
So your code is now reusable.
If a function is generic and can be used for other projects, you can simply
separate it for distribution. So your code is now reusable.

## More Of My Content
- [jdevfullstack Profile](https://github.com/jdevfullstack)
Expand Down

0 comments on commit d6047cc

Please sign in to comment.