Professional Documents
Culture Documents
Cse 1 Theory
Cse 1 Theory
• C is a platform-dependent language.
• C offers the possibility to break down a large program into small modules.
• Also, the possibility of a programmer to control the language.
• C comes with support for system programming and hence it compiles and executes with high
speed when compared to other high-level languages.
• An array is a collection of elements of similar data type whereas the pointer is a variable that
stores the address of another variable.
• An array size decides the number of variables it can store whereas; a pointer variable can store
the address of only one variable in it.
• Arrays can be initialized at the definition, while pointers cannot be initialized at the definition.
Following is the basic structure of a C program.
Documentation Consists of comments, some description of the program, programmer name and any other
useful points that can be referenced later.
Link Provides instruction to the compiler to link function from the library function.
main( ) Every C program must have a main() function which is the starting point of the program
{ execution.
WHILE DO-WHILE
while(condition) while(condition);
Variable in condition is initialized before the variable may be initialized before or within
while loop is entry controlled loop. do-while loop is exit controlled loop.
while(condition) do { statement(s); }
{ statement(s); } while(condition);
A pointer is a variable whose value is the address of another variable, i.e., direct address of the
memory location. Like any variable or constant, you must declare a pointer before using it to
store any variable address.
C Keywords
Keywords are predefined, reserved words used in programming that have special meanings to the
compiler. Keywords are part of the syntax and they cannot be used as an identifier.
C Identifiers
Identifier refers to name given to entities such as variables, functions, structures etc.
Identifiers must be unique. They are created to give a unique name to an entity to identify it
during the execution of the program.
Arrays in C
An array in C is a collection of items stored at contiguous memory locations and elements can be
accessed randomly using indices of an array. They are used to store similar type of elements as in
the data type must be the same for all elements. They can be used to store collection of primitive
data types such as int, float, double, char, etc of any particular type. To add to it, an array in C
can store derived data types such as the structures, pointers etc.
• It is better and convenient way of storing the data of same datatype with same size.
• It allocates memory in contiguous memory locations for its elements. It does not allocate
any extra space/ memory for its elements. Hence there is no memory overflow or
shortage of memory in arrays.
• Iterating the arrays using their index is faster compared to any other methods like linked
list etc.
Definition of 'Debugging'
Definition: Debugging is the process of detecting and removing of existing and potential errors
(also called as ‘bugs’) in a software code that can cause it to behave unexpectedly or crash. To
prevent incorrect operation of a software or system, debugging is used to find and resolve bugs
or defects. When various subsystems or modules are tightly coupled, debugging becomes harder
as any change in one module may cause more bugs to appear in another. Sometimes it takes
more time to debug a program than to code it.
2. Describe the bug. Try to get as much input from the user to get the exact reason.
3. Capture the program snapshot when the bug appears. Try to get all the variable values and
states of the program at that time.
4. Analyse the snapshot based on the state and action. Based on that try to find the cause of the
bug.
5. Fix the existing bug, but also check that any new bug does not occur.
BASIS FOR
COMPILER INTERPRETER
COMPARISON
Working mechanism The compilation is done before Compilation and execution take
code.
Errors Display all errors after Displays error of each line one by
time.
Pertaining C, C++, C#, Scala, typescript PHP, Perl, Python, Ruby uses an
languages