C programming token and datatypes
In this tutorial, you will learn
TOKEN
The token is the smallest individual unit of a program.
There are some token available in C programming are:-
1. Keywords:-
The keywords are some reserved word having a specific meaning which is used during the program.
2. Identifier.-
The identifier means, who identify the variable name, data type, or any name using during the program.
3. Variable:-
The variable means which holds some value.
for e.g- x=,y=4,etc.
4. Constant:-
A fixed value that never changes.
for e.g- x=3;[where 3 is constant].
5. Data type:-
The format of storing a value in a variable is called Data type.
DATA TYPE
As we know, Data type is a format of storing a value in a variable.
There are two types data types available in C
1. Primitive Data type:-
Primitive data types are also known as pre-defined or basic data type, and it represent have a very simple nature( number, character, decimal value).
There are four types of primitive data type are:-
* Char:-
This data type is the use of inputting a character value in the program.
For example:- char arrr='a' ;
For example:- char arrr='a' ;
* Int:-
This data type is used for inputting an integer value in a program.
For example:- Int x=10;
For example:- Int x=10;
* Float:-
This data type is used for inputting a decimal value in a program.
For example:- float d=10.3 ;
For example:- float d=10.3 ;
* Double:-
This data type is used for inputting an integer and decimal value both.
For example:- double x= 12.3;
For example:- double x= 12.3;
2. Derived data type:-
The derived data type in also known as user defined data type.
There are five types of derived data type are:
* Array:-
The array is the collection of homogeneous data items that share a common name, Array contains similar kind of values on a same name it allocates contiguous or sequential memory.
Syntax Data type array name [size] ;
int arr[20] ;
int arr[20] ;
* Pointer:-
A pointer is a variable that stores the address of another variable. The pointer is represented by a sign ( * ).
Syntax:- Data type pointer name ;
Syntax:- Data type pointer name ;
There are some features of the pointer in C programming language are:-
1. Pointer saves memory space.
2. Execution time with pointer is faster because data is manipulated with the address is direct access to memory location.
3. The pointer reduce the length and complexity of the program.
4. The pointer is efficient in handling data and associated with the array.
5. 2D and 3D array and many more dimension array representation is easy in pointer.
5. 2D and 3D array and many more dimension array representation is easy in pointer.
* Structure :-
It is a collection of different data type variable group together under a single name.
Syntax :-
struct structure name
{
data type mem 1 ;
data type mem 2 ;
data type mem 3 ;
, , , , , , , , , , , , ,
, , , , , , , , , , , , ,
data type mem n;
Declaration of structure:-
struct book
{
int pages ;
char name [ 100 ] ;
float price ;
} b ;
* Union :-
* Union is user defined data type just like structure.
* Each member of structure is assigned it's own unique storage area whereas union all the member share common storage area.
* All member share common area so only one member can be active at a time.
* Union are used when all the member are not assigned value at the same time.
syntax:-
Union tag name
{
data type member 1;
data type member 2 ;
};
* Enum:-
An enum is defined in the same way as structure with the keyword struct replace by the keyword enum.
Syntax:-
enum enum name
{
mem 1;
mem 2;
mem 3;
};
c programming language
c programming for prime number
c programming basics
c programming structure
c programming tutorial
c programming array
c programming questions for interview
c programming pdf
for c programming example
c programming examples
c programming questions
c programming interview questions
c programming hello world
what c programming
c programming online compiler
c programming functions
c programming string
c programming online
c programming com…
c programming language
c programming for prime number
c programming basics
c programming structure
c programming tutorial
c programming questions for interview
c programming pdf
for c programming example
c programming examples
c programming questions
c programming interview questions
c programming hello world
what c programming
c programming online compiler
c programming functions
c programming string
c programming online
c programming compiler
c programming in vs code
how learn c programming
c programming software
c programming reverse number
c programming for loop
c programming practice
c programming for beginners
c programming examples with output
c programming recursion
Nice tutorial
ReplyDeleteGood
ReplyDeleteVery helpful for my bca 1st sem
ReplyDeleteGreat!!!!
ReplyDelete