Thursday, September 4, 2008

^^Learnings of the Week

Submitted by:
Joyce Niko D. Perez
IV- RIZAL

History of C Language

B was developed in the year 1970 by Ken Thompson. The said language is a successor of Basic Command Programming Language (BCPL), which was developed by Martin Richards. ¡To augment B’s power, Dennis Ritchie invented and first implemented the C Programming Language in Bell Laboratory. ¡C was originally developed under UNIX environment running in DEC PDP-11. ¡C stands for Combined Programming Language and sometimes called System Programming Language (SPL).

It did not become immediately popular after its creation. It took almost six years when many people read and learned the usefulness of the language after Brian Kernighan and Dennis Ritchie created a famous book called “THE C PROGRAMMING LANGUAGE”.¡X3J11 committee was created in the year 1983 under the American National Standard Institute (ANSI) to provide machine definition of the language and was than approved in 1989. ¡ANSI cooperated with the International Standard Organization (ISO) to refer to as ANSI/ISO 9899:1990”. ¡C is often called a middle-level language. C as a middle-level language means that it combines elements of high-level language with the functionalism of assembly language. It allows manipulation of bits, bytes, and addresses the basic elements with which the computer functions.

Input commands, output commands, and special words often referred to as reserved words allow the use of lower case only. ¡They should be written in lower case since C is sensitive to those words. They have only 32 keywords (27 from Kernighan and Ritchie standard and 5 added by the ANSI Standardization Committee. ¡C encourages the creation of libraries user-defined functions. ¡C is flexible when it allows unrestricted conversion of data from one type to another, such as conversion of a character to its numeric equivalent.


FLOWCHARTING AND ALGORITHMS

Flowchart Defined
Algorithm Defined
Basic Symbols Used in Flowcharting
Basic Control Structures
Operators commonly Used in Flowcharting

Flowcharting Defined

Use of symbols and phrases to designate the logic of how a problem is solved.
A common method for defining the logical steps of flow within a program by using a series of symbols to identify the basic input, process and output function within a program.

A two-dimensional representation of an algorithm; the predefined graphic symbols of a flowchart are used to indicates the various operations and the flow of control . lA diagram representing the logical sequence in which a combination of steps is to be performed. It is a blueprint of the program.


Algorithm Defined


Algorithm is a finite set of instructions that specify a sequence of operations to be carried out in order to solve a specific problem or class of problems.


Basic Symbols Used in Flowcharting

Terminal

Used to signify the beginning and end of flowchart.


Preparation/Initialization
Signifies the preparation of data. lUsed to select initial conditions. lUsed to represent instructions or groups of instructions that will alter or modify a program’s course of execution.


Input/ Output

Shows input and output. Data are to be read into the computer memory from an input device or data are to be passed from the memory to an output device.


Processing

Performs any calculations that are to be done.


Decision

Signifies any decisions that are to be done


On-page Connector

Shows the entry or exit point of the flowchart. A non-processing symbol used to connect one part of a flowchart to another without drawing flow lines. lConserves space by keeping related blocks near one another, reduces the number of flow lines in complex programs, and eliminates cross lines from taking place.


Off-page Connector

Designates entry to or exit from one page when a flowchart requires more than one page.

Flowlines

Signifies the process that is to be executed next.

Sequence
Selection (if-then-else)
Repetition (Looping)


Basic Control Structures


Sequence
Selection
Repetition


Sequence
A process executed from one to another in a straightforward manner.

Repetition (Looping)
This structure provides for the repetitive execution of an operation or routine while the condition is true. The condition is evaluated before executing any process statement. As long as the condition is true, the process is executed, otherwise, control flows out of the structure.



Commonly Used Operators in Flowcharting


Arithmetic Operators
+ addition
- Subtraction
* Multiplication
/ Division


Commonly Used Operators in Flowcharting


Relational Operators
= equal
> Greater than
<> Not equal
> Greater than or equal to
<>


Commonly Used Operators in Flowcharting


Logical operators
&& AND
OR
! NOT


The C Programming Environment


Four parts of C environment
oMain menu
oEditor status line and edit window
oCompiler message window
o“Hot Keys” quick reference line


Main menu

oInstructs C to do something as indicated in the list of menu.
oIt can be activated or can be used by pressing Alt key and the first letter of the menu.
oFor example, press Alt+F to activate File menu.


Basic menu of C

oFile – used to load and save files, handles directories, invokes DOS and exits C.
oRun – used to compile (checks for errors), links and runs the program currently loaded in the environment.
oCompile – used to compile the program currently in the environment.


Submenu under file menu

oLoad – enables the user to select a file to be opened or loaded into the editor.
oPick – enables the user to select a file based on the last nine files previously opened or edited.
oNew – lets the user edit a new file or start new programs.
oSave – store or saves the file currently in the editor.
oWrite to – enables the user to save a file using a different filename.
oDirectory – displays the content of the current working directory.
oChange dir – enables the user to specify the defined path to change the default path or directory.
oOS shell – loads the DOS command processor and lets the user execute DOS commands.
oQuit – lets the user to exit or quit C.


Editor Status Line and Edit Window
oIt is where you type your program and where you see the current line and column of the text you typed.
oIf you try to press Alt- I or Insert Key, the word insert disappears, meaning that the window is in overwrite mode. Press again “insert” to return to the normal mode and notice that the word insert appears again.


Message Window

oThe message window is located beneath the middle of edit window and Hotkeys.
oIt is used to display various compiler or linker messages.


Hot Keys
oHot Keys is located at the bottom of C operating screen.
oIt refers to shortcut or shorthand for selecting a menu.
oTwo sets of Hot keys are available: the normal ones and the alternate set.
oPress the indicated key to use normal hotkeys. For example, press F1 to activate help. On the other hand, press Alt key briefly and the corresponding Function key to use alternate hot keys.


Data Types and Keywords


There are five elementary data types in C: character (char), integer (int), floating point, double floating point and void.

CHAR
Values of type char are used to hold ASCII characters or any 8-bit quantity.

INT
Variables of type int are used to hold real numbers. Real numbers have both an integer.

Float and Double
lValues of type float and double are used to hold real numbers.Real numbers have both an integer and fractional component.

Void

The type void has three uses.
–To declare explicitly a function as returning no value.
-To declare explicitly a function as having no parameters.
–To create generic pointers.


Type Modifiers


Except type void, the basic data types may have various modifiers preceding them.A modifier is used to alter the meaning of the base type to fit the needs of various situations more precisely.

The list of modifiers includes the following:
–Signed
–Unsigned
–Long
–Short


Keywords

Keywords in C are reserved words that have a special meaning.
Reserved words are words “reserved” by the programming language for expressing various statements and constructs, thus, these may not be redefined by the programmer.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home