400 likes | 1.12k Views
STRUCTURE OF A SIMPLE C PROGRAM. <#include directive> <#define directive> Main() { <variable declaration section> statements … }.
E N D
STRUCTURE OF A SIMPLE C PROGRAM <#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”(LIM02)Example: #include <stdio.h>
#define directive- “used to shorten the keywords in the program”Example: #define g gotoxy
Variable declaration- “It is the place where you declare your variables
Body of the program- “start by typing main() and the { and } braces” Note:“Turbo C is a case sensitive program, therefore use lowercase letters only.”
Commonly used include files in C language (SARR97)1. alloc.h-declares memory management functions.2. conio.h-declares various functions used in calling IBM-PC BIOS.3. ctype.h-contains information used by the classification and character conversion macros.4. math.h-declares prototype for the math functions.5. stdio.h-defines types and macros needed for standard I/O.6. string.h-declares several string manipulation and memory manipulation routines.
Important Symbols(SARR97)\n -is a line char used to move the cursor to the next line.‘o’ -single quote is used for single character / letter.“o” -double quote is used for two or more characters.{ -open curly brace signifies begin.} -close curly brace signifies end.& -address of operator. -indirection operator / pointer.
Variable DeclarationType variable list:Example: int I, j, k;short I, j, k;2 kinds of variablelocale.i. #include<stdio.h>main () {int a, b, c