New Cohort Summer 2026 Tech Internships are now open! Limited seats available.
← Course Detail

C & C++ Programming

Computer Science

Chapter 2 — Variables, Data Types and Operators

Progress: 10%

Lesson 2.1 : Variables in C and C++

Reading & Interactive Lesson

Lesson 2.1 FREE

Variables in C and C++

Reading Material & Notes

Variables in C and C++

A variable is a named memory location used to store data during program execution. Variables allow programs to store values that can change while the program is running.

Variable Declaration

In C and C++, a variable is declared by specifying its data type followed by its name.

int age;
float salary;
char grade;

Variable Initialization

A variable can be assigned an initial value when it is declared.

int age = 20;
float price = 99.50;

Rules for Naming Variables

  • A variable name can contain letters, digits and underscore.
  • It cannot begin with a digit.
  • Keywords cannot be used as variable names.
  • Variable names are case-sensitive.

Example

#include <stdio.h>

int main()
{
    int age = 20;
    printf("Age = %d", age);
    return 0;
}

Key Points

  • Variables store program data.
  • Every variable has a data type.
  • Variables should have meaningful names.

Course Curriculum

10 Chapters • 50 Lessons

View Course

Chapter 4 — Functions and Modular Programming

5 Lessons

LOCKED
Lesson 4.1 : Introduction to Functions
ENROLL
Lesson 4.2 : Function Parameters and Return Values
ENROLL
Lesson 4.3 : Function Declaration and Prototypes
ENROLL
Lesson 4.4 : Call by Value and Call by Reference
ENROLL
Lesson 4.5 : Recursion and Modular Programming
ENROLL

Chapter 5 — Arrays and Strings

5 Lessons

LOCKED
Lesson 5.1 : Introduction to Arrays
ENROLL
Lesson 5.2 : One-Dimensional Arrays
ENROLL
Lesson 5.3 : Two-Dimensional Arrays
ENROLL
Lesson 5.4 : Strings in C
ENROLL
Lesson 5.5 : Strings in C++
ENROLL

Chapter 6 — Pointers and References

5 Lessons

LOCKED
Lesson 6.1 : Introduction to Pointers
ENROLL
Lesson 6.2 : Pointer Arithmetic
ENROLL
Lesson 6.3 : Pointers and Arrays
ENROLL
Lesson 6.4 : Pointers and Functions
ENROLL
Lesson 6.5 : References in C++
ENROLL

Chapter 7 — Structures, Unions and Enumerations

5 Lessons

LOCKED
Lesson 7.1 : Structures in C and C++
ENROLL
Lesson 7.2 : Structure Variables and Arrays
ENROLL
Lesson 7.3 : Unions in C and C++
ENROLL
Lesson 7.4 : Enumerations
ENROLL
Lesson 7.5 : Structures, Unions and Enumerations Project
ENROLL

Chapter 8 — Object-Oriented Programming in C++

5 Lessons

LOCKED
Lesson 8.1 : Introduction to Object-Oriented Programming
ENROLL
Lesson 8.2 : Classes and Objects
ENROLL
Lesson 8.3 : Constructors and Destructors
ENROLL
Lesson 8.4 : Encapsulation and Access Specifiers
ENROLL
Lesson 8.5 : Abstraction in C++
ENROLL

Chapter 9 — Inheritance, Polymorphism and Templates

5 Lessons

LOCKED
Lesson 9.1 : Inheritance in C++
ENROLL
Lesson 9.2 : Types of Inheritance
ENROLL
Lesson 9.3 : Polymorphism in C++
ENROLL
Lesson 9.4 : Function and Operator Overloading
ENROLL
Lesson 9.5 : Templates in C++
ENROLL

Chapter 10 — File Handling and Mini Projects

5 Lessons

LOCKED
Lesson 10.1 : File Handling in C
ENROLL
Lesson 10.2 : File Handling in C++
ENROLL
Lesson 10.3 : Reading and Writing Structured Data
ENROLL
Lesson 10.4 : C and C++ Mini Project Development
ENROLL
Lesson 10.5 : Final C and C++ Project
ENROLL

C & C++ Programming

Chapters

10

Lessons

50

View Course Details