Friday, August 24, 2012

the basics of c program

As a building is made of bricks, a c program is made of basic elements such as expressions, statements, statement blocks, constants, and variables.

constants and variables: A constant is a value that never changes while a variable can be used to present different values.
ex. i=1, symbol '1' represents the constants and symbol 'i' represents the variable.

Expressions: An expression is combination of constants, variables and operators that are used to denote the computations.

for ex: (4+8)*6-i+7.

C-Arithmetic operator: 
symbol                    meaning
+                           addition
-                            subtraction
*                           mmultiplication
/                            division
%                         remainder 

Statements: A statement is a complete instruction, ending with a semicolon.
e.g i=8;

Statement Blocks: A group of statements can form a statement block that starts with an opening brace ({) and ends with a closing brace (}).
e.g {
s4=9-7;
s3=s4+i;
   .
   .
   .
    }

No comments:

Post a Comment