Lecture 3 & 4 - Elements of Programming
Elements of Programming Language
Scope and Coverage
Character Set
Variables
Constants
Data Types
Declaration (constants and variables)
Operators
Expressions
Learning Objectives
Understand and explain various elements such as character set, constants, operators, and expressions and their usage in programming.
Understand and explain various data types.
Explain what variables are and how to declare and define them using the character set.
Demonstrate knowledge of using operators to write expressions.
Character Set
Definition
A character set is a set of all valid characters that can be used in a program.
Specifies characters or symbols recognized by a programming language.
Comprises characters used to form words, numbers, and expressions in source programs:
Source Character Set: Characters used for the source program text.
Execution Character Set: Characters used during program execution.
Components of Character Set
Letters: A-Z, a-z
Lowercase: a b c d e f g h i j k l m n o p q r s t u v w x y z
Uppercase: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Digits: 0-9 (10 decimal digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
Special Symbols: Space, +, -, *, /, ^, \ , (), [] , {}, =, !=, <, >, ., ‘, $, ", ;, :, %, !, &, _, #, <=, >=, @
Special Characters
Character | Name | Meaning |
|---|---|---|
// | Double Slash | Beginning of a comment |
# | Pound Sign | Beginning of a preprocessor directive |
< > | Open/Close Brackets | Enclose filename in #include |