C Programming,Klase Notes,Programming Notes
No comments
Structure of C Program and Format Specifiers
<#include directive>
<#define directive>
main()
{
<variable declaration section>
Statements
…
}
#include directive – “contains information needed by the program to ensure the correct operation of Turbo C’s standard library functions."
Example: #include <stdio.h>
#define directive – “used to shorten the keywords in the programs.”
Example: #define g gotoxy
Variable declaration section – “it is the place where you declare your variable.”
Body of the program – “ start by typing main() and the { and } (open and close braces). All statements should be written inside the { and } braces.”
NOTE: Turbo C is a case-sensitive program, use lowercase letters only.
Commonly used include files in C language
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 classification and character conversion 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.
Basic Input/ Output Statements of C
Usually, our program involves three main operations. The first one is the input operation that uses input functions such as scanf, getch(), gets(), getche(), getchar() and others. The second is the process operation. In this part of our program, we can see some equations that are calculated, conditions that are evaluated, and tasks being performed. The third part is the output operation. Here, we use output statements such as printf() function, puts(), putch(), putchar functions and other output statement functions. To learn this technique, we can jump right in and type our first program that involves these three main operations.
All format specifiers start with a percent sign(%) and are followed by a single letter indicating the type of data and how data are to be formatted.
0 comments:
Post a Comment
If possible, leave a positive comment. No hate speech or elicit comments. Thank you.