KwickAcademy C · 8 min · free
C Tokens, Data Types, Variables and Constants
Tokens are the smallest pieces of a C program; data types set what a variable holds and how much memory it needs. An identifier cannot start with a digit, contain spaces, or be a keyword.
Follows the syllabus of: GSEB Std 10 Computer Studies
On screen in this lesson
C tokens
| Token | Meaning | Example |
|---|---|---|
| Keyword | reserved word | int, return |
| Identifier | a name you make | marks |
| Constant | fixed value | 75, 'A' |
| String literal | text in quotes | "Hello" |
| Operator | does an action | +, = |
| Special symbol | punctuation | ; { } |
Keywords
| Reserved words with a fixed meaning |
| The classic C standard has 32 keywords |
| All are in small letters: int, if, while |
| You cannot use a keyword as a name |
Rules for identifiers
| Rule | Valid | Invalid |
|---|---|---|
| Letters, digits, _ | total_marks | total-marks |
| No digit first | marks2 | 2marks |
| No spaces | rollNo | roll no |
| Not a keyword | count | float |
| Case matters | Age, age | differ |
Basic data types
| Type | Stores | Usual size |
|---|---|---|
| char | one character | 1 byte |
| int | whole number | 4 bytes |
| float | decimal, 6 digits | 4 bytes |
| double | decimal, 15 digits | 8 bytes |
Sizes depend on the compiler
| Old 16-bit compilers like Turbo C: int = 2 bytes |
| Modern compilers like gcc: int = 4 bytes |
| char is always 1 byte |
| sizeof tells the exact size on your system |
What is a variable?
| A named box in memory that holds a value |
| Declare it first: type then name |
| int marks; reserves space for a whole number |
| The value can change while the program runs |
Quick answers
Is 2marks a valid variable name?
No. An identifier cannot start with a digit.
What does float avg = 7 / 2; store?
3.0, because 7 / 2 is whole number division.
KwickClips from this lesson
Short clips, one idea each. Good for revision the night before.
Is roll no a valid name?43 sec
Why do some books say int is 2 bytes?44 sec
What must come before using a variable in C?41 sec
What happens if you assign to a const?40 secThe full lesson, in text
Hello students, welcome to Kwickprep. Can you name a variable int, or 2marks? Both give an error, and today you will learn exactly why. We will study tokens, keywords, identifiers, data types with their sizes, variables, and constants.
A token is the smallest meaningful piece of a C program, like a word in a sentence. A keyword is a reserved word with a fixed meaning, like int or return. An identifier is a name you choose, like marks. A constant is a fixed value, like seventy five or the character A. A string literal is text inside double quotes. An operator does an action, like plus or equals. Special symbols include the semicolon and curly braces.
Let us look closely at keywords. A keyword is a word that C has reserved for itself. The classic C standard, called C eighty nine, has thirty two keywords, and newer standards add a few more. All keywords are written in small letters, like int, if and while. You can never use a keyword as a variable name, so int int equals five is an error.
An identifier is a name you give to a variable or function, and it must follow rules. It may contain letters, digits and the underscore, but not a dash. It cannot start with a digit, so marks two is fine but two marks is not. It cannot contain spaces. It cannot be a keyword, so float is not allowed as a name. And C is case sensitive, so capital Age and small age are two different names.
A data type tells C what kind of value a variable holds, and how much memory it needs. A byte is a small unit of memory, made of eight bits. The char type stores one character and uses one byte. The int type stores a whole number and usually uses four bytes. The float type stores a decimal number with about six correct digits, in four bytes. The double type stores a decimal with about fifteen correct digits, in eight bytes.
Be careful, because the size of int is not fixed by C. Old sixteen bit compilers, like Turbo C, use two bytes for an int, and some textbooks still show that. Modern compilers use four bytes. A char is always one byte. To find the real size on your computer, use the sizeof operator.
Here we print sizes using sizeof. The percent z u format is the correct way to print a size. On a modern computer this prints one, four and eight. That means a char takes one byte, an int four bytes, and a double eight bytes.
Now, variables. A variable is a named box in memory that holds a value. In C, you must declare a variable before using it, which means you write its type and then its name. Int marks, semicolon, reserves space for one whole number called marks. The value inside a variable can change while the program runs, which is why it is called a variable.
To initialise means to give a variable its first value at the moment we declare it. Here a batter has forty five runs, and the grade is the character A in single quotes. Then she hits a six, so runs becomes runs plus six. Percent d prints an int and percent c prints a char. The output is fifty one, A. In modern C, main may skip return zero, because zero is returned by default.
A constant is a value that never changes, also called a literal. An integer constant is a whole number, like one hundred or minus seven. A real constant has a decimal point, like three point one four. A character constant is one character inside single quotes. A string constant is text inside double quotes, and it can hold many characters.
We can give a constant a name using hash define. The line hash define PASS thirty three means, wherever PASS appears, put thirty three. Note there is no equals sign and no semicolon. The marks are forty, so marks minus PASS prints seven. Constant names are written in capital letters by custom.
The second way is the const qualifier. A qualifier is a word that adds a rule to a declaration. Const means this variable is read only, so its value cannot change after it is set. Here a G S T rate of eighteen percent is stored as zero point one eight. The bill is five hundred rupees, so the tax prints as ninety point zero zero. Percent point two f prints two digits after the decimal point.
What happens if we try to change a const? A sleeper coach has seventy two seats, stored as a const. On the next line we try to set SEATS to eighty. The compiler stops with an error, assignment of read only variable. The mistake is caught before the program ever runs.
Exams often ask the difference between hash define and const. Hash define is handled by the preprocessor, which just replaces text, while const is checked by the compiler. A hash define has no data type, but a const variable has one. A hash define line has no semicolon, but a const declaration does. A hash define uses no memory of its own, while a const variable is stored in memory.
Pause and predict. Seven divided by two is three point five, right? But here both seven and two are integer constants, so C does whole number division. The answer is three, and the decimal part is dropped. Storing three in a float gives three point zero. So the output is three, and three point zero. Write seven point zero divided by two to get three point five.
Let us revise what we learned today. Tokens include keywords, identifiers, constants, strings, operators and symbols. An identifier cannot start with a digit, have spaces, or be a keyword. A char takes one byte, an int usually four, a float four, and a double eight. Every variable is declared before use, with its type and then its name. And const or hash define create values that cannot change.
Courses that teach this
| Course | Unit |
|---|---|
| GSEB Std 10 Computer Studies | Programming Fundamentals & C Language |
| Programming All levels C | Data Types, Variables, and Operators |
Voice-over in this lesson is AI-generated. The script is written and checked by Kajal Ma'am. Boards can revise a syllabus mid-year, so confirm anything you plan around against the official board circular. Keep your passwords, OTPs and ID numbers to yourself — we never ask for them. To reach Kajal Ma'am, use the WhatsApp button; sharing your number there is how we call you back.
Free to watch, no sign-up. Live classes with Kajal Ma'am are the paid course; these lessons stay free either way.

