Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Characteristics:-
Like most imperative languages in the ALGOL tradition, C has facilities for structured programming and
allows lexical variable scope and recursion, while a static type system prevents many unintended operations. In
C, all executable code is contained within functions. Function parameters are always passed by value. Pass-by-
reference is simulated in C by explicitly passing pointer values.
Heterogeneous aggregate data types (struct) allows related data elements to be combined and manipulated as
a unit. C program source text is free-format, using the semicolon as a statement terminator.
C also exhibits the following more specific characteristics:
Variables may be hidden in nested blocks partially weak typing. For instance, characters can be used as
integers. Low-level access to computer memory by converting machine addresses to typed pointers Function
and data pointers supporting ad hoc run-time polymorphism array indexing as a secondary notion, defined in
terms of pointer arithmetic.
A preprocessor for macro definition, source code file inclusion, and conditional compilation Complex
functionality such as I/O, string manipulation, and mathematical functions consistently delegated to library
routines A relatively small set of reserved keywords A large number of compound operators, such as +=, -=,
*=, ++ etc.
Character Set Consists Of
Whenever we write any C program then it consists of different statements. Each C Program is set of
statements and each statement is set of different c programming lexims. In C Programming each and every
character is considered as single lexim. i.e [Basic Lexical Element]
Symbol Meaning
~ Tilde
! Exclamation mark
# Number sign
$ Dollar sign
% Percent sign
^ Caret
& Ampersand
* Asterisk
( Left parenthesis
) Right parenthesis
_ Underscore
+ Plus sign
| Vertical bar
\ Backslash
` Apostrophe
Minus sign
= Equal to sign
{ Left brace
} Right brace
[ Left bracket
] Right bracket
: Colon
Quotation mark
; Semicolon
< Opening angle bracket
> Closing angle bracket
? Question mark
, Comma
. Period
/ Slash
C Tokens Chart
In C Programming punctuation, individual words, characters etc. are called tokens.
Tokens are basic building blocks of C Programming
Token Example:
No Token Type Example 1 Example 2
1 Keyword do while
2 Constants number sum
3 Identifier -76 89
4 String HTF PRIT
5 Special Symbol * @
6 Operators ++ /
Basic Building Blocks and Definition:
Token Meaning
A variable is a meaningful name of data storage location in computer memory. When using a
Keyword
variable you refer to memory address of computer
Constant Constants are expressions with a fixed value
Identifier The term identifier is usually used for variable names
String Sequence of characters
Special
Symbols other than the Alphabets and Digits and white-spaces
Symbol
Operators A symbol that represent a specific mathematical or non-mathematical action
Example Of Declaration :
int ivar;
float fvar;
char cvar;
Operators in C Language:-
Arithmetic Operator in C Programming Language
1. C Programming Supports 5 Arithmetic Operators.
2. Arithmetic Operators are used for Arithmetic Calculation.
Supported Arithmetic Operators:
5 arithmetic operators are shown in the following table. Arithmetic operators are used to perform
arithmetic operations in c programming.
Operator Meaning Example
+ Addition Operator 10 + 20 = 30
- Subtraction Operator 20 10 = 10
* Multiplication Operator 20 * 10 = 200
/ Division Operator 20 / 10 = 2
% Modulo Operator 20 % 6 = 2
In C Programming , Unary operators are having higher priority than the other operators. Unary Operators are
executed before the execution of the other operators. Increment and Decrement are the examples of the Unary
operator in C.
void main()
{
int a,b,x=10,y=10;
a = x++;
b = ++y;
printf("Value of a : %d",a);
printf("Value of b : %d",b);
}
Output :
Value of a : 10
Value of b : 11
We have seen increment operator in C Programming which increments the value of the variable by 1. Similarly
C Supports one more unary operator i.e decrement operator which behaves like increment operator but only
difference is that it decreases the value of variable by 1.
void main()
{
int a,b,x=10,y=10;
a = x--;
b = --y;
printf("Value of a : %d",a);
printf("Value of b : %d",b);
}
Output :
Value of a : 10
Value of b : 9