What Will I Learn?
In this section, you will find an explanation of the various terms and concepts we will use in the future, as well as an introduction to C's. It will be much easier to learn C using these terms and concepts. You may have never heard of these concepts before. This may lead to confusion. But I would recommend reading until the end.
After reading this section, you should be able to answer the following questions and explain the concepts:
Questions:
- a ) What is Token and how many groups are separated?
Concepts:
- 1 ) Token Concept
Difficulty
- Basic
Tutorial Contents
- Token Concept
The smallest one that makes sense for a programming language is called Token. Tokens are the simplest elements of programming languages that can not be divided into more meaningful parts. The source code is parsed by the compiler and divided into tokens.
Below are examples of "BASIC" and "C" programs that have the same functions.
BASIC
C
- Tokens in the example BASIC program are:
- Tokens in the example C program are:
Tokens are divided into groups.
- 1 ) Keywords, Reserved Words
They have meaning for the programming language and are not used as variables.
For example BASIC program;
PRINT, INPUT, FOR, TO, NEXT, END
For example C program;
include, int, for
- 2 ) Identifiers, Variables
These tokens usually set a place in memory.
For example BASIC program;
K, N
For example C program;
main, n, k
- 3 ) Operators
Operators perform predetermined operations. +, -, *, /, <, > Operators...
For example BASIC program;
The only operator in the BASIC program
=
For example C program;
(...), &, =, <=, ++
- 4 ) Constants
They are direct transactions, tokens without variable information.
For example BASIC and C program;
There is only one token: 1
- 5 ) String literal
These are tokens written in double quotes.
For example BASIC program;
"enter a number" a single token
For example C program;
"enter a number"
"%d"
"%d\n" expressions one String token
- 6 ) Separators, Punctuators
Except for other token groups , are tokens used as delimiters and terminators.
For example BASIC program;
10
20
30
40
50
For example C program;
{
;
,
}
Finish Thank you visit my article.
Posted on Utopian.io - Rewarding Open Source Contributors