C Language Thoery
C Language Thoery
C Language Thoery
1)call by value:
1]In this method,the value of actual parameter is passed to the formal parameters.
2]Any changes made by the function to the value of the formal parameters does not affect the value
of corresponding actual parameters.
3]In this method,actual parameter can be lateral,constant or some expression or some function call.
In all cases it will pass the value of actual parameter to corresponding formal parameters.
2]call by reference:
1]In this method,instead of passing the value of the actual paramters it passes the address(pointer)
and therefore function will recieve the address of the formal parmeters.
2]In this method the formal parameters must be pointer variable of appropriate type.
3]As function receive the address of actual parameters and hence any changes made by function to
the value of formal parameter will affect to the actual parameters.
Ans:
1]C language is a case sensitive language i.e., c-compiler will differentiate between upper and lower
case.
4]Whenever c program is compiled it will translate the c language program into executable
file(machine language program).
prg1.c ------->c-compiler-------->p1.exe------->cpu-------->output
file
*What is comment?
2]The comment will help later to understand the certain detail of the programming.
Ans:
1]A function represents a block of code i.e.,the group of statement enclosed within[{}]curly bracket.
5]The number of statement within a function we depend on what task function is performing.
8]In a program Function may be define in any order but exexcution always begins from main.
*What is #include?
Ans:
1]There are certain statement in c language which begins with # sign all such statement are called as
preprocessor statement.
2]Preprocessor is a part of c-compiler which process preprocessor statement before the compilation
and as a result certain c language code will be added or generated in a source program.
3]#include statement will add the code of header file in source program and then program will be
compiled.
5]There can be several input satement written one after another to include various library file.
Ans:
2]A c provides key statements to check and execute statement according conditional criteria.
1]if statement,
2]if-else statement,
3]switch statemnet,
*What is loop?
Ans:
2]A loop is used using condition.The repetititon is done until condition becomes contion true.
Ans:
1]It is well known as 'Jumping ststement'.
2]The goto statement is used to change the normal sequence of program execution by transferring
control to the other part of the program.
label:statements;
goto label;
5]It is primarily used to transfer the control of execution to any place in a program.It is useful to
provide branching within a loop.
Ans:
3]One of the most important feature of this loop is that the three actions are taken at a time such as
initialization,condition checking and increment or decrement.
for(initialization;test-condition;increment/decrement)
statements;
1]Initial expression is initialized at the begining of the for loop.then,the test expression is checked by
the program,if it is false then, for loop is terminated.
2]But,if test expression is true,then the codes are executed and expression is updated.again,the test
expression is checked,if it is false ,loop is terminated and if it is true,the same process repeates until
test expression is false.
while(condition)
statements;
incerement/decrement;
1]In above syntax,the condition is checked first.if it is true,then the program control flow goes inside
the loop and executes the block of statements associated with it.
2]At the end of loop increment or decrement is done to change in variable value.This process
continues until test condition satisfies.
Ans:
2]Sometimes,there is need to execute a block of statement first then to check condition.At that timw
such type of loop is used.
do
statements;
(increment/decrement);
}while(condition);
2]At first codes inside the test expression is checked.if it is true,code inside of do are executed again
and the process continues until test expression becomes false(zero).Notice,there is semicolon in the
end of while();in do ...while loop.