Saturday, September 20, 2008

LEARNINGS OF THE WEEK (TAGARO)

STRUCTURE OF A SIMPLE C PROGRAM
BY: Sharra Mae S. Tagaro IV- Rizal


This week, we discussed more about C language- specifically its structure.

Structure of a simple C program
#include
#define directive
main()
{
variable declaration section;
______________________
______________________
}
  • n#include directive – contains information needed by the program to ensure the correct operation of C’s Standard library functions.
  • n#define directive – used to shorten the keywords in the program.
  • nVariable declaration section – it is the place where you declare your
variables.
  • nBody of the program – start by typing main() and the { and }. All statements
should be written inside the braces.
Commonly used include files in C language.
  • nalloc.h – declares memory management functions.
  • nconio.h – declares various functions used in calling IBM-PC ROM BIOS.
  • nctype.h – contains information used by the calssification and character convertion macros.
  • nmath.h – declares prototype for the math functions.
  • nstdio.h – defines types and macros needed for standard I/O.
  • nstring.h – declares several string manipulation and memory manipulation routines.
Important Symbols
  • n\n – is a line char used to move the cursor to the next line
  • n‘ ‘ – single quote is used for single character / letter.
  • n“ “ – double quote is used for two or more character
  • n{ - open curly brace signifies begin
  • n} – close curly brace signifies end
  • n& - address of operator
  • n* - indirection operator / pointer


No comments: