Keywords
Key terms are conventional identifiers that have conventional described significance in C. Key terms are all lowercase, since uppercase and lowercase people are not comparative it's possible to implement an uppercase search term as an identifier but it's not a excellent coding exercise.
Points to remember
1. Keywords terms can be used only for their designed objective.
2. Keywords terms can't be used as designer described identifier.
3. The keywords can't be used as brands for factors.
The standard keywords are given below:-
Constants
The phrase continuous indicates that it does not modify during the performance of system.In the terminology C, continuous and is the information with a continuous value that does not modify in the system. For example, in the system "100" "3.14" "'A'" "" Hello "" and the like, if you create information immediately, and continuous. Moreover, also known as a literal continuous. Constant concept is an concept composed only of always the same. There are four primary kinds of always the same in C. They are:
1.Integer constants
2.Floating-point constants
3.Character constants
4.String constants
Integer and floating-point always the same signify statistics. They are often generally known as numeric-type always the same. The following guideline relates to all number kind constants:
Comma and empty areas cannot be provided within the always the same.
Constants can be beat by a – or + indication, if preferred. If either indication does not come before the continuous it is believed to be good.
The value of a continuous cannot surpass specified lowest and highest possible range. For each form of continuous, these limited differ from one C compiler to another.
Data Types
C offers a standard, little set of primary information kinds. Sometimes these are called "primitive" kinds. A lot of complicated information components can be developed from these primary information kinds. The C language describes 4 fundamental information types:
character
integer
floating-point and
double floating-point
This information kinds are announced using the key terms char,int,float and twice respectively. Common storage requirements of the primary information kinds are given below:-
The dimension and range of these information kinds may differ among brand kinds and compilers. Data kind qualifiers change the conduct of diverse kind to which they are used. Data kind qualifiers can be categorized into two kinds.two kinds.
1. dimension qualifiers
2. indication qualifiers
Size qualifiers:
Size qualifiers change the dimension the primary information kinds. There are two dimension qualifiers that can be used to integer: lengthy and brief.
The lowest dimension brief int is 16 bit. The dimension int must be higher than or similar to that of a brief int. The dimension lengthy int must be higher than or similar to a brief int. The lowest dimension a lengthy int is 32 pieces.
Sign qualifiers:
The key terms finalized and unsigned are the two indication qualifiers that specify whether a diverse can hold both –ve and +ve statistics, or only +ve statistics. These qualifiers can be used to the information kinds int and char only.
Example: unsigned int I;
The following table shows all legitimate information kind blends reinforced by C, along with their little varies and typical storage dimension.
Statements
The statements of a C program control the flow of program execution.In c language several kinds of statements are available.They are
If statement
switch statement
goto statement
for statement
while statement
do-while statement
break statement
return statement
null statement
continue statement
Symbolic Constant in c Program
A outstanding continuous is name that alternative for a series of personality that cannot be modified. The personality may signify a number continuous, a personality continuous, or a sequence. When the system is collected, each incident of a outstanding continuous is modified by its corresponding personality series. They are usually described at the starting of the system. The outstanding always the same may then appear later in the system in position of the number always the same, personality always the same, etc., that the outstanding always the same signify.
For example
, a C system includes the following outstanding continuous descriptions.
#define PI 3.141593
#define TRUE 1
#define FALSE 0
#define PI 3.141593 describes a outstanding continuous PI whose value is 3.141593. When the system is preprocessed, all events of the outstanding continuous PI are modified with the alternative textual content 3.141593.
Note that the preprocessor claims start with a #symbol, and are not end with a semicolon. By meeting, preprocessor always the same are published in UPPERCASE.
Example: 1
#include<stdio.h>
#include<conio.h>
#define TRUE 1
#define PI 3.141593
void main()
{
flow a;
flow b;
flow c;
flow d=PI;
clrscr();
if(TRUE)
{
a=100;
b=a*10;
c=b-a;
}
printf("\na=%f\nb=%f\nc=%f\nPI=%f",a,b,c,d);
getch();
}
Operators
An operators in common, is a icon that performs on a certain data type. C language is very full of providers. The widely used Operators include.
1. Arithmetic operators
2 Relational operators
3. Logical operators
4. Assignment operators
5. Conditional operators
6. Comma operators
7. Bnary operators
8. Bitwise Operators
1. Arithmetic operators
2 Relational operators
3. Logical operators
4. Assignment operators
5. Conditional operators
6. Comma operators
7. Bnary operators
8. Bitwise Operators
Variables
variables are method for place in storage used by a system to shop information. The dimension that prevent relies on the variety over which the diverse is permitted to differ.
For example, on laptop or pc the dimension an integer diverse is two bytes, and that of a lengthy integer is four bytes.
A diverse area is momentarily keep in mind a variety or sequence value, such as protected by the system. To recognize the variables, you have a name exclusive to every individual diverse. This is known as a diverse name. Before using a diverse, use variables to what is known as a diverse announcement that you have to expose the brands and information kinds that can be saved in the diverse varying.
The structure for announcing a diverse in C.
[Storage-class] kind information diverse name [= preliminary value];
Storage category and the preliminary value can be overlooked.
The same information kind and storage space category diverse can be announced, divided by commas.
[Storage-class] kind information diverse name [= preliminary value] diverse [= preliminary value] diverse [= preliminary value];
In C the dimension a diverse kind such as an integer need not be the same on all kinds of devices. When we announce a diverse we notify the compiler of two elements, the name of the diverse and the form of the diverse. For example, we announce a diverse of kind personality with the name i by writing:
char i;
On seeing the "char" aspect of this declaration the compiler places aside one bytes of storage to carry the value of the personality. It also places up a icon desk. In that desk it contributes the icon i and the comparative deal with in storage where those one byte was set aside. Thus, later if we write: i = 'x'; we anticipate that,at run time when this declaration is implemented, the value 'x' will be placed in that storage place set aside for the storage space of the value of i.
Following are the guidelines for labeling the variables:
1.All variables must be announced before they can appear in exe declaration.
2.A announcement includes a information kind followed by one or more diverse brands divided by commas.
Example: int a,b,c;
3.Variables can be allocated among conditions in any style. The above announcement can be published as
int a;
int b,c;
4.Integer kind variables can be announced to be brief integer for lesser integer amounts or lengthy integer for bigger integer amounts.
Example:
short int a,b,c;
long int a,b,c;
5.An integer diverse can also be announced to be un finalized by composing unsigned int.
Example: unsigned int;
Example:-
Comments
Comments are included to create a system more legible to you but the compiler must neglect content. Everything that is within /* and */ is regarded a statement and will be ignored by the compiler. You must not involve comments within other comments, so something like this is not allowed: [*].
/* this is a /* thoughts */ in the statement, which is wrong! */
Example:-
No comments:
Post a Comment