A C program is consist of tokens like..
Pre processor
Function
Variable
Statement and expression
Comments
Etc...
Keywords
keywords are the reserved words in c programming with specific meaning defined in the compiler or in other words we can say that keywords are predefined, reserved words used in programming that have special meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier. 32 keywords are following
auto |
double |
int |
struct |
break |
else |
long |
switch |
case |
enum |
register |
typedef |
char |
extern |
return |
union |
continue |
for |
signed |
void |
do |
if |
static |
while |
default |
goto |
sizeof |
volatile |
const |
float |
short |
unsigned |
Identifiers
In c programming identifiers are the name to identify denote the variable,arrays ,structure, union ,function etc...
Shubham =× SHUBHAM
Because c language is a case sensitive language
Note
A c program is made up of multiple tokens which include keywords identifier constant string literals symbols operator function recursion structure array union etc
Data type
- Basic Data Type= Floating-point, integer, double, character.
- Derived Data Type= Union, structure, array, etc.
- Enumerated Data Type= Enums
- Void Data Type= Empty Value
- Bool Type=True or False
Program to find the size of data type
int a;
float b;
char c;
double d;
// Size of Variables
printf("Size of int: %ld bytes \n", sizeof(a));
printf("Size of float: %ld bytes \n", sizeof(b));
printf("Size of char: %ld bytes \n", sizeof(c));
printf("Size of double: %ld bytes", sizeof(d));
return 0;
}
C operators
An operator is simply a symbol that is used to perform operations. There can be many types of operations like arithmetic, logical, bitwise, etc.
There are following types of operators to perform different types of operations in C language.
1 Arithmetic Operators
2 Relational Operators
3 Logical Operators
4 Bitwise Operators
5 Ternary or Conditional Operators
6 Assignment Operator
7 Misc Operator
- Arithmetic Operators
- The arithmetic operators perform addition, subtraction, multiplication, division, exponentiation, and modulus operations.
- Relational Operators
- A relational operator is a programming language construct or operator that tests or defines some kind of relation between two entities. These include numerical equality (e.g., 5 = 5) and inequalities (e.g., 4 ≥ 3).
- Logical Operators
- A logical operator is a symbol or word used to connect two or more expressions such that the value of the compound expression produced depends only on that of the original expressions and on the meaning of the operator. Common logical operators include AND, OR, and NOT.
- Bitwise Operators
- The bitwise AND operator ( & ) compares each bit of the first operand to the corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.
- Ternary or Conditional Operators
- The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark ( ? ), then an expression to execute if the condition is truthy followed by a colon ( : ), and finally the expression to execute if the condition is falsy.
- Assignment Operator
- The assignment operator = assigns the value of its right-hand operand to a variable, a property, or an indexer element given by its left-hand operand. The result of an assignment expression is the value assigned to the left-hand operand
- Misc Operator
- misc operator is miscellaneous operator, which is conditional operator which has 3 operands,The first operand is always evaluated first. If nonzero, the second operand is evaluated, and that is the value of the result. Otherwise, the third operand is evaluated, and that is the value of the result