TaleemBay
Study
UniversitiesScholarshipsFeesDates
TaleemBay

Empowering students with Next-Gen tools for a brighter future. Your one-stop destination for education in Pakistan.

Quick Links

  • Universities
  • Study Center
  • Past Papers
  • Date Sheets
  • Results

Support

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service
  • Advertise

Contact Us

  • Arfa Software Technology Park,
    Ferozepur Road, Lahore
  • +92 300 1234567
  • hello@taleembay.com

© 2026 TaleemBay. All rights reserved.

Designed with ❤️ for Pakistan

Home
Unis
Study

Study Center

Overview
9th Class10th Class11th Class12th Class

Resources

Past PapersDate Sheets

Need Notes?

AI-powered search for instant answers.

Chapter 9
computer-science • intermediate 12th

Chapter 9: Elements of C

Comprehensive notes for Chapter 9 Elements of C. Covers Identifiers, Keywords, Data Types, Variables, Constants, and Operators.

Identifiers

Definition: Names used to represent variables, constants, types, functions, and labels in the program.

Rules:

  • Max 31 characters (extra ignored).
  • First character must be alphabet or underscore (_).
  • Cannot use keywords.
  • No special symbols allowed except underscore.

Types:

  • Standard Identifiers: Special meaning in C (e.g., printf, scanf). Can be redefined (not recommended).
  • User-defined Identifiers: Defined by programmer (e.g., marks, salary).

Keywords

Definition: Words with predefined meaning and purpose. Cannot be redefined. Written in lowercase.

List (32 Keywords): auto, break, case, char, const, continue, default, do, double, else, enum, extern, float, for, goto, if, int, long, register, return, short, signed, sizeof, static, struct, switch, typedef, union, unsigned, void, volatile, while.

Variables

Definition: Named memory location to store data. Value can change during execution.

Declaration: Specifying name and type. type variable_name; (e.g., int marks;).

Initialization: Assigning value at declaration. type variable = value; (e.g., int a = 10;).

Garbage Value: Meaningless data in uninitialized variable.

Data Types in C

Integer Data Types:

  • int: 2 bytes. Range: -32768 to 32767.
  • short: 2 bytes. Range: -32768 to 32767.
  • unsigned int: 2 bytes. Range: 0 to 65535.
  • long: 4 bytes. Range: -2,147,483,648 to 2,147,483,647.
  • unsigned long: 4 bytes. Range: 0 to 4,294,967,295.

Floating Point Data Types:

  • float: 4 bytes. Range: 10^-38 to 10^38. Precision: 6 decimal places.
  • double: 8 bytes. Range: 10^-308 to 10^308. Precision: 15 decimal places.
  • long double: 10 bytes. Range: 10^-4932 to 10^4932. Precision: 19 decimal places.

Character Data Type:

  • char: 1 byte. Stores ASCII characters. Range: -128 to 127 (signed), 0 to 255 (unsigned).

Constants

Definition: Quantity that cannot be changed during execution.

  • Integer Constants: Numeric values without decimal (e.g., 10, -5).
  • Floating Point Constants: Numeric values with decimal (e.g., 3.14, 2.5e3).
  • Character Constants: Single char in single quotes (e.g., 'A', '9').
  • String Constants: Characters in double quotes (e.g., "Pakistan").

Operators in C

  • Arithmetic: +, -, *, /, % (Modulus - remainder).
  • Relational: Compare values. ==, !=, >, <, >=, <=. Returns True (1) or False (0).
  • Logical: Combine conditions. && (AND), || (OR), ! (NOT).
  • Assignment: = assign value. Compound: +=, -=, *=, /=, %= (e.g., a+=10 same as a=a+10).
  • Increment/Decrement: Unary operators. ++ increases by 1, -- decreases by 1.
    • Prefix: ++x (Change then use).
    • Postfix: x++ (Use then change).

Operator Precedence

Order of evaluation in expression:

  1. Parentheses ()
  2. Unary !, ++, --
  3. Multiplicative *, /, %
  4. Additive +, -
  5. Relational <, <=, >, >=
  6. Equality ==, !=
  7. Logical AND &&
  8. Logical OR ||
  9. Assignment =, +=, etc.
Download PDFPDF