Table of Contents
What is Char in Pascal?
What is Char in Pascal? Char is a data type of the Pascal Programming Language. As discussed in my older posts. A Character or Char is one of the basic data types that we use in softwares made by Pascal. Char can store ASCII characters. But it’s not needed to store ASCII characters. Rather it can store about any character provided if it’s only one.
What is ASCII?
ASCII stands for “American Standard Code For Information Interchange”.
All code at its pure, every bit of softwares is only 0s and 1s. Which in coding terms we know as Binary. We use ASCII codes to represent text within a computer in the form of binary 0s and 1s.
Personal Opinion
In my personal opinion the Char data type might be a bit hard to understand. But all in all as you progress in this course things will begin to make a whole lot of sense! For now let’s practice calling a Character! Keep the next paragraph in mind :
A data type is a type. To call it we need to give the computer an item and tell it that “Hey this item i gave you is from now on a Character”. We cannot call the type itself and hope that the computer understands it! As mentioned above i’ll give a example in the next paragraph.
.
Example Of Characters or Char
For learning purposes, I’ll show you a simple way to assign a Character to a Variable in the below example. Don’t panic i’ll explain what a variable is in a later post. For now here is how we assign a Variable to the data type Character or Char.
As used in all the previous data type posts. To keep things simple we will use the Lazarus software to write the code. And tell the computer to run that code within the command prompt.
Steps Of The Example
Step : 1
Open up Lazarus and on the top right click File. Then click New.

After clicking New a menu shall appear with a variety of softwares that can be made with the Lazarus IDE. In this instance..
Step 2 : Choose the Program application type as shown in the image below.

Step 3 : Write the code! For this instance we shall declare a Variable to the data type Character and tell the Computer to print out the contents of the Variable onto the command prompt.
program Project1; {$mode objfpc}{$H+} uses {$IFDEF UNIX} cthreads, {$ENDIF} Classes { you can add units after this }; var character : char; begin character := 'B'; writeln; writeln; writeln(character); writeln('Press <Enter> To Quit!'); readln; end.
In the Lazarus IDE the first lines which say “uses” or “Classes”. Everything above the line which says “var” is already made for us. So don’t panic on that. Write the code as mentioned above! (You can copy paste it even!).
Step 4 : Run the code! Press F9 on your keyboard in the Lazarus IDE to compile and run the code. The resulting application should be a command prompt. Which says the letter we declared (in this instance B) and the text “Press <Enter> To Quit”.
That is a simple example of Characters Or Char. In the next post i will talk about another data type Booleans. Afterwards once the basics of data types remain taken care of. I’ll explain the Variable thing i did back there. Proceeding on!
Another Way To Learn
As mentioned above, Personally speaking Characters or Char is kinda hard to understand by my perspective. To understand it properly, I recommend not only reading this article but also to watch this video from a famous Youtube channel known as SchoolFreeWare.