C Programming Language Main Structures
C Programming Language Elements :
1. Preprocessor directives
Command line which is given instruction to preprocessor.
There are two types of preprocessor : #include and #define.
#include library.h tell preprocessor the library to find the meaning of standard identifier.
#define NAME value tell preprocessor to change every identifier NAME with value before the program was compiled.
Example :
#include stdio.h
#define PI 3.14
2. Comment
Texts which is started with /* or // and finished with */, and contains information about program in order to make the program is understood easily by other programmer. Compiler will ignore comments.
3. Main Function
Syntax :
int main(void)
{
/* main function */
}
Main function is made up from 2 parts :
1. Declaration
2. Executeable Statement
4. Reserved Word and Identifier
Reserved Word :
- word which has special meaning in C and can’t be used again for other.
Example : int, void, double, return, etc.
Identifier :
a. Standard Identifier :
A word which has special meaning in C but it can’t be redefined by user(not recommended).
Example : printf, scanf, etc.
b. User Defined Identifier :
A word which is choosed by user to rename memory cell and user defined operation.
Example : miles, name, x, PI, etc
Expression Evaluation Rule :
1. Parentheses Rule
2. Operator Presedence Rule
From High to Low :
Function calls
!, +, -, & (operator unary)
*, /, %
+, -
<, <=, >=, >
==, !=
&&
||
=
3. Associative Rule
Unary - - > evaluate from Right to Left
Binary - - > evaluate from Left to Right
0 comments:
Post a Comment