C-Language
CS 535 Introduction to Scientific Computing Theory : 3rd Lecture
History
A brief mention:
Computer Language :
Low level : Machine language Middle level : Assembly language
High Level : C, Java, Fortran, so many
So C is a high level language Designed by
Every language has a set of symbols
Cs Character Set
Cs Character Set
Every language has a set of symbols Symbols are only for creating words
Cs Words : Identifiers
Cs Words : Identifiers
Cs Words : Identifiers
Every language has a set of symbols Symbols are only for creating words
Some words are called proper nouns with a distinction of their own
Cs Key words
Cs Key words
My resolution is constant; will not change till the end of this life
Cs Constants
Numeric constants Rules
Integer Numeric constants Rules
Decimal Integer constants Rules
Octal Integer constants Rules
Hexadecimal Integer constants Rules
Hexadecimal Integer constants Rules
Floating Point constants Rules
Floating Point constants Rules
Character constants Rules
Character constants Rules
String constants Rules
characters that are embedded within the string
Symbolic constants Rules
corresponding character sequence
Symbolic constants Rules
The price is variable quantity, so it may change its values in the market
Variables
Escape Sequence
Escape Sequence
null
\0
000
Data Types
Data Types
Variable Declaration
Examples Variable Declaration
Examples Variable Declaration
declaration
Initializing Variable
Initializing Variable
initially assigned the character *
Type Conversion
Examples : Type Conversion
Examples : Type Conversion
Examples : Type Conversion
Examples : Type Conversion
Examples : Type Conversion
Examples : Type Conversion
Operators
Types of Operators
Arithmetic Operators
Modulus operator
Arithmetic Operators
Arithmetic Operators : Examples
expression
Arithmetic Operators : Examples
Arithmetic Operators : Examples
Arithmetic Operators : Conversion
Arithmetic Operators : Conversion
Arithmetic Operators : Conversion
Arithmetic Operators : Conversion
Type Conversion summary
Higher long double double float unsigned long long long long
unsigned long
long unsigned int int unsigned short short unsigned char
char
Lower
Unary Operators
Unary Operators
Unary Operators
Unary Operator : Example
Unary Operator : Example
Unary Operator : Example
Unary Operator : Example
Relational & Logical Operators
Relational & Logical Operators
Relational & Logical Operators
Relational & Logical Operators
Relational & Logical Operators
Relational & Logical Operators
Relational & Logical Operators
Relational & Logical Operators
Relational & Logical Operators
Relational & Logical Operators
Assignment Operators
Assignment Operators
Assignment Operators
Assignment Operators
Assignment Operators
value of the conditional expression
Assignment Operators
Assignment Operators
Other assignment operators: C also has five additional assignment operators: +=, -+, *=, /=, and %= To see how they work, consider the first operator +=. The assignment expression :
Expression 1 += Expression-2
is equivalent to : Expression 1 = Expression 1 + Expression 2
Bitwise Operators
Left Shift Operator
Right Shift Operator
Special Operators
Associativity & Precedence
Associativity & Precedence
Associativity & Precedence
Practice Problems
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
have been entered successfully.
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
conversion character
Input and Output
Input and Output
Input and Output
Input and Output
Input and Output
Control Structures
Control Structures
Control Structures
statement will be ignored
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Control Structures
Repetition Statement : for
For Loop:
for (initialisation; repetition_condition ; update) { Statement1; ... ... StatementN; } Execution Details: (1) it executes the initialisation statement. (2) it checks to see if repetition_condition is true. If it isn't, it finishes with the "for loop" completely. But if it is, it executes each of the statements Statement1 ... StatementN in turn, and then executes the expression update. (3) After this, it goes back to the beginning of step (2) again.
Repetition Statement : for loop
Repetition Statement : while loop
Repetition Statement :do-while loop
do-while loop:
do{ statement 1; statement 2; .. statement n; }while(condition); Execution Details:
Same as while loop. Only difference is that condition is checked at the end. So the set of statements must be executed at least once.
Practice Problems