GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • C programming
  • C++ programming
  • Java programming
  • Python programming
  • HTML
  • CSS
  • Codenora IDE (opens in a new tab)
  • About us
  • Pricing
  • Contact us
  • Privacy policy
  • Terms of service
  • Refund and Cancellation

This view

  • Original page
  • New address

GeezerVison is showing www.dremendo.com — Character Variable in C++ Programming | Dremendo

  • Dremendo
  • C
  • C++
  • Java
  • Python
  • HTML
  • CSS
  • More
    • Home
    • C Tutorial
    • C++ Tutorial
    • Java Tutorial
    • Python Tutorial
    • HTML Tutorial
    • CSS Tutorial
?>
profile image
Announcements
No new announcements.
mentora icon
C++ Programming Tutorial
  • C++ Basic Concepts
    • Introduction
    • Variable
    • Data Types and Modifiers
    • Naming Conventions
    • Integer Variable
    • Float and Double Variables
    • Character Variable
    • Boolean Variable
    • Constant Variable
    • Typecasting
  • Operators in C++
    • Operators
    • Assignment Operators
    • Arithmetic Operators
    • Relational Operators
    • Logical Operators
    • Operator Precedence
  • Input and Output in C++
    • Environment Setup
    • Program Basic Structure
    • cout Statement
    • cin Statement
    • Comments
  • Decision Making in C++
    • Decision Making
    • if Statement
    • if else Statement
    • if else if Statement
    • Conditional Operator
    • switch case Statement
  • Mathematical Functions
    • Mathematical Functions
  • Loops in C++
    • What are Loops
    • for Loop
    • while Loop
    • do while Loop
  • Arrays in C++
    • One Dimensional Array
    • Two Dimensional Array
  • String in C++
    • C-Style String
    • C-Style String Methods
    • String
    • String Methods
  • Searching in C++
    • Linear Search
    • Binary Search
  • Sorting in C++
    • Bubble Sort
    • Selection Sort
    • Insertion Sort
  • Pointer in C++
    • Pointer
    • Dynamic Memory Allocation
    • References
  • User Defined Datatype in C++
    • Structure
    • Union
    • Enum
  • Function in C++
    • Function
    • Recursive Function
    • Function Overloading
    • Storage Classes
    • User-Defined Header Files
  • Data Structures in C++
    • Stack
    • Queue
    • Circular Queue
    • Double Ended Queue
    • Singly Linked List
    • Doubly Linked List
    • Stack using Linked List
    • Queue using Linked List
  • OOPs in C++
    • Classes and Objects
    • Instance Variables
    • Instance Methods
    • Access Specifiers
    • Constructor
    • Destructor
    • Static Variables
    • Static Methods
    • Friend Function
    • Friend Class
    • Inheritance
    • Types of Inheritance
    • Polymorphism
    • Abstract Class
  • File Handling in C++
    • Text File Handling
    • Binary File Handling

bookmark
Table of Contents

    Character Variable in C++ Programming

    In this lesson, we will discover how to declare and use character variables in C++ programming with this practical guide. Get hands-on with examples and take a quiz to reinforce your understanding.

    What is Character Variable

    In C++ programming, a character variable can hold a single character enclosed within single quotes. To declare a variable of this type, we use the keyword char, which is pronounced as kar. With a char variable, we can store any character, including letters, numbers, and symbols.

    Video Explanation

    Click the button below to watch the explanation.

    Please wait while the video is loading....
    video image
    Syntax of Declaring Character Variable in C++
    char variable_name;

    Here char is used for declaring Character data type and variable_name is the name of variable (you can use any name of your choice for example: a, b, c, alpha, etc.) and ; is used for line terminator (end of line).

    Now let's see some examples for more understanding.

    Example 1

    Declare a character variable x.

    char x;
    Example 2

    Declare 3 character variables x, y, and z to assign 3 different characters in it.

    char x='A', y='5', z='#';
    Example 3

    Declare a character variable x and assign the character '$' and change it value to '@' in the next line.

    char x = '$';
    x = '@';    //now the new value of x is @
    Note

    A character can be anything, it can be an alphabet or digit or any other symbol, but it must be single in quantity.

    Test Your Knowledge

    Attempt the questions in the exercise to check whether you have understood the lesson clearly.

    Exercise
    Test Your Knowledge
    Previous Next

    We care about your privacy

    Dremendo uses cookies and similar technologies that are necessary for the site to work properly, understand how you interact with our website, and measure the effectiveness of our marketing. By clicking Accept All, you consent to the use of non-essential cookies and similar technologies for analytics, advertising, and ad measurement, as described in our Privacy Policy.

    Cookie Preferences

    Choose which types of cookies Dremendo may use.

    Necessary Cookies

    Required for essential website functionality and security.

    Allow
    Analytics Cookies

    Help us understand how visitors use Dremendo.

    Allow
    Marketing Cookies

    Help us measure advertising performance and understand interactions with our advertisements.

    Allow
    Mentora Question Asked: 0 / 20

    Hi, I’m Mentora!

    I’m your personal AI tutor from Dremendo. Ask me anything, and I’ll help you understand it in a simple and easy way.

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.