Technical Interview Questions and Answers :: C
11 / 123
To declare more than one same type of varibale.
eg:
int i,j,k;
To print variables
eg: int i=2;
printf("%d",i);
12 / 123
Declaring a variable is initializing a variable where as defining a variable is defining what variables you are initialized.
13 / 123
By default the value unchanged means we can give as static.
Variable which is declared as static and no further initialisation then static variable takes value from zero.
14 / 123
Register variables are a special case of automatic variables. Automatic variables are allocated storage in the memory of the computer; however, for most computers, accessing data in memory is considerably slower than processing in the CPU. These computers often have small amounts of storage within the CPU itself where data can be stored and accessed quickly. These storage cells are called registers.
15 / 123
Each program is allocated two types of storage stack and heap .Auto variables are also known as local variable
and are stored in stack.
16 / 123
Scope: it defines the life time of a variable depends on declaration of a variable.If it is declared inside the variable it is local variable,If it is outside it is global variable.
Extern variables: belong to the External storage class and are stored in the main memory
17 / 123
Register variables: is the register storage class and are stored in the CPU registers.
The scope of the register variables is local to the block in which the
variables are defined. The variables which are used for more number of
times in a program are declared as register variables for faster access.
18 / 123
Storage memory:Automatic:RAM , register: RAM
19 / 123
a failure in a program to release discarded memory, causing impaired performance or failure.
20 / 123
If we see any loop if break is present then the loop terminates and comes out of the loop. Break is used in switch .
Where as in continue it just skips the below statements.continue is used in loops