The C programing language. The c program presented in previous slide is composed of 3 functions: the main function, the function greet1 and the function greet2. Therefore we can say that we can create a program that is composed of other function aside from the main function. Note: The main( ) function should always be present in every C program.
Functions are the building blocks of C in which all program activity occurs. A function is also called a subprogram or subroutine. It is a part of a C program that performs a task, operation or computation then may return to the calling part of the program.
Other functions aside from the main( ) can only be executed by the program through a “function call”.Note: Function call is a C statement that is used to call a function to execute C statements found inside the function body.Going back to the example, greet1( ); is an example of a function call, calling the function greet ( ). main ------clrscr------printf greet1( ) function call------greet1( ) functiongreet2 function call----greet2( ) function getch( )
FILE TYPES:
alloc.h – declares memory management functions.
conio.h – declares various functions used in calling IBM-PC ROM BIOS.
ctype.h – contains information used by the calssification and character convertion macros.
math.h – declares prototype for the math functions.
stdio.h – defines types and macros needed for standard I/O.
string.h – declares several string manipulation and memory manipulation routines.
SYMBOLS:
\n – is a line char used to move the cursor to the next line
‘ ‘ – single quote is used for single character / letter.
“ “ – double quote is used for two or more character
{ - open curly brace signifies begin
} – close curly brace signifies end
& - address of operator
* - indirection operator / pointer
STRUCTURE:
#include directive – contains information needed by the program to ensure the correct operation of C’s Standard library functions.
#define directive – used to shorten the keywords in the program.
Variable declaration section – it is the place where you declare your variables.
Body of the program – start by typing main() and the { and }. All statements should be written inside the braces.
Other functions aside from the main( ) can only be executed by the program through a “function call”.Note: Function call is a C statement that is used to call a function to execute C statements found inside the function body.Going back to the example, greet1( ); is an example of a function call, calling the function greet ( ). main ------clrscr------printf greet1( ) function call------greet1( ) functiongreet2 function call----greet2( ) function getch( )
FILE TYPES:
alloc.h – declares memory management functions.
conio.h – declares various functions used in calling IBM-PC ROM BIOS.
ctype.h – contains information used by the calssification and character convertion macros.
math.h – declares prototype for the math functions.
stdio.h – defines types and macros needed for standard I/O.
string.h – declares several string manipulation and memory manipulation routines.
SYMBOLS:
\n – is a line char used to move the cursor to the next line
‘ ‘ – single quote is used for single character / letter.
“ “ – double quote is used for two or more character
{ - open curly brace signifies begin
} – close curly brace signifies end
& - address of operator
* - indirection operator / pointer
STRUCTURE:
#include directive – contains information needed by the program to ensure the correct operation of C’s Standard library functions.
#define directive – used to shorten the keywords in the program.
Variable declaration section – it is the place where you declare your variables.
Body of the program – start by typing main() and the { and }. All statements should be written inside the braces.
No comments:
Post a Comment