Do the exercises based on the text
Functions in C Programming with examples
We will learn functions in C programming.
A function is a block of statements that perform a same task. If you are writing a C program and you need to perform a same task in that program more than once, you have two options:
a) Use the same set of statements every time you want to perform the task
b) Create a function to perform that task, and just call it every time you need to perform that task.
Using option (b) is a good practice and a good programmer always uses functions while writing code in C.
Why we need functions in C
Functions are used because of following reasons:
a) To improve the readability of code.
b) Improving the reusability of the code the same function can be used in any program rather than writing the same code from scratch.
c) Debugging of the code would be easier if you use functions because errors are easy to be traced.
d) It reduces the size of the code, duplicated set of statements are replaced by function calls.
Available on https://beginnersbook.com Acceso el 1 de noviembre, 2020.
A- Diga si las afirmaciones son verdaderas o falsas. Justifique las falsas.
1. Aprenderemos las funciones de la programación en C.
2. Una función es un bloqueo de declaraciones.
3. Una función realiza diferentes tareas.
B- Complete en español.
1. Use the same ...
2. Create a function ...
3. Using option (b) is ...
C- Conteste las siguientes preguntas:
1. ¿ Qué mejora las funciones de C?
2. ¿ Qué se puede usar para no escribir el mismo código desde cero?
3. ¿ Qué sería más fácil si se usa si se usan las funciones?
No comments:
Post a Comment
Deje sus comentarios.