Variables and Functions are the important things in any programming language. Other than that every language has some statements called conditional statements (if, if else, if else-if, switch)and looping statements (for, while, do-while). Then we have operators called arithmetic operator, relational operator, logical operator, assignment operator. That’s all we need to understand for writing code🤷♂️. We build all programs using pretty much these things. (PS:-Don’t byheart syntax it is available in internet. Practice writing code to build logic)
Tokens :- A token is the smallest unit in the source code. The compiler reads the source code as a sequence of tokens, and each token represents a fundamental building block of the language. Tokens are the basic elements that make up a program, and they are classified into several categories. Eg:- keywords, identifiers, variables, datatypes, operators etc.
Keywords :- Reserved words that have special meaning in the programming language. Eg:- int, float, if, else, while, etc.
Identifiers :- An identifier is a name given to various program elements such as variables, functions, arrays, etc. Identifiers provide a way to uniquely identify and refer to these elements in the program.
Operators :- Operators are symbols that represent computations or operations to be performed on operands. Operands are the values or variables that are involved in an operation.
1) Arithmetic Operators : + — * / %
2) Relational Operators : == != < > <= >=
3) Logical Operators : && || !
4) Assignment Operator : = += -= *= /= %=
5) Increment and Decrement Operators : ++ —
Datatypes :- Datatypes are used to define the type of data that a variable can store. Eg:- int, float, char, bool, double
Variables :- A variable is a named storage location that holds a value with a specific data type. Variables allow you to manipulate and store data within a program.
Function :- A function is a self-contained block of code that performs a specific task. Functions are designed to break down a program into modular and manageable units, improving code organization, reusability, and readability.
- Function definition
- Function calling
Condition statements :- Conditional statements allow you to control the flow of execution based on certain conditions.
1) if
2) if else
3) if else-if
4) switch
Loop statements :- Loop statements are used to execute a block of code repeatedly. There are several types of loops.
1) for
2) while
3) do while
Some special keywords used :-
1) return : The return statement is used in a function to return a value to the calling code and terminate the function’s execution.
2) break : The break statement is used to exit from a loop or a switch statement prematurely.
3) continue : The continue statement is used to skip the rest of the code inside a loop for the current iteration and move to the next iteration of the loop.
Array : An array is a collection of elements of the same data type that are stored in contiguous memory locations. Arrays provide a convenient way to group related data under a single name and access individual elements using an index.
Some important basic algorithms of array manipulation to learn:
1) search — linear, binary
2) sort — bubble, selection
3) insert an element to array
4) delete an element from array