Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 1.22 KB

lect2.md

File metadata and controls

64 lines (50 loc) · 1.22 KB

Lecture 2 : Identifiers

  • Contants
  • Variables
  • Keywords
  • Data Types

1. Contants

  • any information is constant
  • Data = Information = Constant

Types of Constants

  1. Primary
    • Integer (5,100,-64,79,106)
    • Real (5.0, 1.06)
    • Character ('A', '5', '+')
  2. Secondary
    • Array
    • String ("Priyanshu")
    • Pointer
    • Union
    • Structure
    • Enumerator
    • Class

2. Variables

  • variables are the names of memory locations where we store data
  • variable name is any combination of alphabet (a to z or A to Z), digit (0 to 9) and underscore (_)

3. Keywords

  • predined words used to perform certain operations
auto double int struct asm private
break else long switch catch public
case enum register typedef class protected
char extern return union delete template
const float short unsigned friend this
continue for signed void inline throw
default goto sizeof volatile new try
do if static while operator virtual

4. Data types

  • int (integer)
  • char (Character)
  • float (Real)
  • double (Real)
  • void

Unlike C, we can declare variables even after action statements in C++

Example :

int main()
{
    clrscr();
    int x=4;
}