1. A function is a section of code that performs a specific task and makes programming simpler by splitting problems into sub-problems.
2. There are different types of functions including void functions without arguments, void functions with input arguments, and functions that return a single result.
3. Functions allow code to be reused by calling the function from the main program or from other functions. Functions can take input arguments and return values to provide modularity and simplify programming.
2. What is function? A function is a section of a program that performs a specific task . Solving a problem using different functions makes programming much simpler with fewer defects . It’s a solution for a big project that split into small sub project.
3. Common Type (FUNCTION) Void function Without argument Void unction With Input argument Function with input argument and single result
4. Void function without argument syntax: void functionname(void) Example: display() draw_circle() draw_triangle() The nearest explantion is printf()
5. Void function without argument void draw_triangle(void){ introw,space,star; for(row=1;row<=9;row++) { for(space=8;space>=row;space--) { printf("%c",288); }; for (star=1;star<row;star++) { printf("* "); } printf(""); } }
6. Why void? (most common seen in function without argument) Void is use when the function does not return any value More explanation: The subfunction is called draw_triangle() from the main function but the function prototype is written as void draw_triangle(void)
7. Void function with input argument syntax:functiontypefunctionname(input) Example: double box(123.45) circumference(5.0) calculate(inum1)
21. GO TO Is a function in programming c that allows you to jump according to designation labels Syntax: gotolabel; Just simply means to redirect you to the label located in the coding label: Just simply means to redirect you to the label