CONCEPTS OF C LANGUAGE
Published: 2021-10-25 05:39:03


Algorithms:
“A step by step to solve the given problem is called as algorithm”
Properties: 1)finiteness 2)definiteness 3)Input 4)Output 5)effectiveness
Flowchart:
Pictorial representation of an algorithm is called Flow chart.
Different Symbols used in Flowchart are: Oval–>Start or Stop Arrow or
Line --> Flow Direction Parallelogram–>Input or Output Double sided
-->Rectangle Sub program/ function Rectangle Process Circle Connector
Rectangle -->Process Diamond -->Decision5)effectiveness
Flowchart:
Pictorial representation of an algorithm is called Flow chart.
Different Symbols used in Flowchart are: Oval–>Start or Stop Arrow or
Line --> Flow Direction Parallelogram–>Input or Output Double sided
-->Rectangle Sub program/ function Rectangle Process Circle Connector
Rectangle -->Process Diamond -->Decision
Identifiers
–> A C identifier is a name used to identify a variable, function, or any
other user-defined item
Variable
–>A variable is defined as a meaningful name given to the data storage
location in computer memory.
Data Types in C:
1. Primary data types –>Integer Type –>character data type –>Floating
Point Type –>void data type
2)Derived data types
These are also called secondary data types that include array , structures,
union and pointers.
3)User-defined data types
Control Statements
statements which are used to make a choice i.e; statements which has two
or more paths should be followed.
Control statements are categorized by considering following elements:
–>continuation at a different statement –>executing a set of statements
only if some condition is met. –>Executing a set of statements zero or more
times until some condition is met. –>Executing a set of distinct statements
, after which the flow of control usually returns.
Branching statements are (conditional statements or decision making
statements )
–>if –>if … else –>Nested if –>Switch-selection statement
Looping statements are: –>do-while –>for
LOOPS:
Iteration and repetitive execution (for, while, do-while), nested loops.
1. for
2. while
3. do-while

for loop diagram

while loop diagram

do-while loop diagram
ARRAY:
An array is a fixed size sequenced collection of elements of the same data
type.
Arrays are declared using the following syntax:
Syntax: <array_name>[size of array];
—>Data Type: What kind of values array can store (Example: int , float,
char). –>array_name: To identify the array. –>Size of array(INDEX): The
maximum number of values that the array
STRINGS:
In C programming, array of characters is called a string. A string is
terminated by a null character /0.
For example: “c string tutorial” Here, “c string tutorial” is a string. When,
compiler encounter strings, it appends a null character /0 at the end of
string
Declaration of strings
Before we actually work with strings, we need to declare them first. Strings
are declared in a similar manner as arrays. Only difference is that, strings
are of chartype.
Initialization of strings
In C, string can be initialized in a number of different ways. For
convenience and ease, both initialization and declaration are done in the
same step.
Using arrays char c[] = “abcd”;
FUNCTIONS:
A function is a group of statements that together perform a task. Every C
program has at least one function, which is main ().
USES OF C FUNCTIONS:
–>C functions are used to avoid rewriting same logic/code again and again
in a program. –> There is no limit in calling C functions to make use of
same functionality wherever required.
RECURSION:
A function that calls itself is known as a recursive function. And, this
technique is known as recursion
HOW TO CALL C FUNCTIONS IN A PROGRAM?
There are two ways that a C function can be called from a program. They
are,
1. Call by value
2. Call by reference
Storage classes
Storage class specifiers in C language tells the compiler where to store a
variable, how to store the variable, what is the initial value of the variable
and life time of the variable. Syntax: storage_specifier data_type variable
_name;
TYPES OF STORAGE CLASS SPECIFIERS IN C:
There are 4 storage class specifiers available in C language. They are,
1. auto
2. extern
3. static
4. register
STORAGE SPECIFIER
Auto
Extern
Static
Register
DESCRIPTION
Storage place: CPU Memory Initial/default value: Garbage value Scope:
local Life: Within the function only.
Storage place: CPU memory Initial/default value: Zero Scope: Global Life:
Till the end of the main program. Variable definition might be anywhere
in the C program
Storage place: CPU memory Initial/default value: Zero Scope: local Life:
Retains the value of the variable between different function calls
Storage place: Register memory Initial/default value: Garbage value
Scope: local Life: Within the function only.
POINTERS:
Pointers are one of the derived types in C. One of the powerful tool and easy
to use once they are mastered. Some of the advantages of pointers are listed
below:
1. A pointer enables us to access a variable that is defined outside the
function.
2. Pointers are more efficient in handling the data tables.
3. Pointers reduce the length and complexity of a program
There are three concepts associated with the pointers are,
1. Pointer Constants
2. Pointer Values
3. Pointer Variables
Pointer to pointer:
Pointer is a variable that contains the address of the another variable.
Similarly another pointer variable can store the address of this pointer
variable, So we can say, this is a pointer to pointer variable.
STRUCTURES:
–>Declaring structures and structure variables, accessing members of a
structure, arrays of structures, arrays within a structure.
Structure Declaration and Definition
A structure is declared using the keyword struct . Like all data types,
structures must be declared before using it. C has two ways to declare a
structure.
1. Tagged structure declaration.
2. Typedef structure declaration.
syntax and example of structure
UNION:
A union is a user defined data type similar to structure. It is a collection of
variables of different data types. The only difference between a structure
and a union is that in case of unions, memory is allocated only to the
biggest union member and all other members should share the same
memory. In case of a structure, memory is allocated to all the structure
members individually. Thus unions are used to save memory. They are
useful for applications that involve multiple members, where values need
not be assigned to all the members at any one time