Comments and identifier in C
In this section I will clear the concept about Comments and identifier in C to prepare of your exams or interviews !
Comments :-
comments are used to clarify something about program in plain language.
It is way to add notes to our program.
There are two types of comments in C ::-
☝ Single Line Comment :- // this is a comment.
single line comment used to comment on only for one sentences or line.
✌ Double Line Comment :- /* this is
multi line comment */
Multi line comment are used to add big sentences or paragraph like comments .
|
Comments |
Identifier :-
Identifier are user defined words that are use to named the variables, functions, Arrays, Structures etc.
There are some rules for declaring identifier are :
1. Name consists only of alphabets (both upper case and lower case) ,numbers,
underscore sign.
2. Name not be a keywords.
3. First character will be alphabet or underscore.
4. The upper case and lower case define differentely beacuse C language is case
sensitive.
Ex. more , MORE etc. are various identifiers.
An identifier is most valuable and important content in C language.
The identifier are normally given in some meaningful name .. such as- age, value , net_salary etc.
An identifier name may be big. some implementation recognize first eight character , but most recognize 31 characters.
Data Types :-
An indication of how the programmer intends to utilise the data is provided to the compiler or interpreter via a data type.
Data types belongs to an extensive system used for declaring variables or functions of different types before its use.
The type of a variable identify how much space it takes in storage and how the bit pattern stored is interpreted.
The value of a variable can be changed any time.
C has the following 4 of data types :-
basic built-in data types: int, float, double, char
Enumeration data type: enum
Derived data type: pointer, array, structure, union
Void data type: void
A variable declared to be of type int can be used to contain integral values only—that is, values are do not contain decimal places.
A variable declared to be of type float can be used for storing floating- point numbers (values containing decimal places).
The double type is the same as type float, only with hardly twice the precision.
The char data type can be used to store a single character, such as the letter a, the digit character 6, or a semicolon similarly, A variable declared char can only store character type value.
There are two types of type qualifier in C :-
Size qualifier: short, long
Sign qualifier: signed, unsigned
Almost all of programming languages are supports data types of integral, Real, Boolean, character, String etc.
|
Data types |
#programmers
Post a Comment