C – Tokens:
2.Identifiers:
Const data_type variable_name = value;
For example:
The pi(π) value is standard value i.e. 22/7 = 3.14.
4.String:
It has a special built-in meaning in the C language.
C – Tokens are small and each of every individual unit or parts in a program called tokens.
It has six kinds of tokens. There are
It has six kinds of tokens. There are
- Keywords (eg: int, while),
- Identifiers (eg: a, b),
- Constants (eg: 5, 10),
- Strings (eg: “Hello”, “Welcome”),
- Special symbols (eg: (), {}),
- Operators (eg: +, /,-,*)
- It is pre-defined words in C. (i.e., Fixed words for creating programs in C)
- List of keywords in C language:
auto
|
double
|
int
|
struct
|
break
|
else
|
long
|
switch
|
case
|
enum
|
register
|
typedef
|
char
|
extern
|
return
|
union
|
const
|
short
|
float
|
unsigned
|
continue
|
for
|
signed
|
Void
|
default
|
goto
|
sizeof
|
Volatile
|
do
|
if
|
static
|
While
|
- Identifiers are user-defined words in c program such as variable name, function name, array name, and etc.
- It is a fixed value in C.
- But it can be changed during it’s before execution.
- Users can also create constant throw syntax.
Const data_type variable_name = value;
For example:
The pi(π) value is standard value i.e. 22/7 = 3.14.
4.String:
- Strings are collections of characters or alphabets i.e. words
- It is used to display for users.
It has a special built-in meaning in the C language.
Expression
|
Symbols
|
Asterisk
|
*
|
Assignment
|
=
|
Ampersand
|
&
|
Brackets
|
[]
|
Braces
|
{}
|
Comma
|
,
|
Double-quotes
|
“
|
Front lash
|
/
|
Parentheses
|
()
|
Pre-processor
|
#
|
Semi-colon
|
;
|
1. 6.Operators:
Operators are symbols
and used to perform some mathematics operations.
Six kinds of
operators,
1. Arithmetic operators(+,-,*,/,%,++,--)
2. Relational
Operators (==,!=,<=,>=,<,>)
3. Logical
Operators (&&,||,!)
4. Assignment
Operators(=,+=,-=,*=,/=,%=)
5. Conditional
Operators (?:)
6.
Bitwise
Operators(&,|,^,<<,>>)
Example:
Output:
#include<stdio.h>
#include<conio.h>
void main()
{
const int a=5;
const int b=10;
int c;
clrscr();
c=a+b;
printf("Addition of a and b value is: %d",c);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
const int a=5;
const int b=10;
int c;
clrscr();
c=a+b;
printf("Addition of a and b value is: %d",c);
getch();
}
Explanations:
- Keywords - main,int,printf,clrscr,getch
- Identifiers - a,b,c
- Constants - a=5,b=10
- String- printf(“Addition of a and b value is: %d”,c);
- Special symbols-(),{,},;,”
- Operators -=,+
No comments:
Post a Comment