1. Function is a self contained block of a statements
enclosed between braces that performed a specific
tasks or a function is a group of numbers of repeated
statements in a program into a single unit and is
identified by a name known as function name
There may be one or more function in a program but
the main function is a essential part of the program.
Function can be implemented any where in a program
wherever it is needed, so as to prevent repetition of
same instructions again and again in the program
For example we might use the factorial of a number at
different places in a program the same set of
instruction for calculating factorial of a number are
places in a function
2. Function reduces the size of the program as repetition of
instruction is reduced because these are written only once in a
function that is instead of writing debugging and compiling the
same set of instructions again and again the port can be re used.
Function supports modular programming in which a large
program is divided into smaller self contained parts. Each of
which as a unique identification which makes the program easy
to write understand debugging and maintained.
Function promotes portability of a programs since function
writing are independent of system dependent features
Designing of large and complex programs becomes very easy
and fast using function. This is because different functions can be
involved In which it can be later combined to make the complex
program, which results in reduction of time and cost
Different data sets can be transferred to the function ,each time it
is invoked which helps in saving a lot of memory space by
allowing same set of statements to be used for different set of
data
In “c” language ,a function can call it self again ,this is known as
3. 1. Library function
2. User define function
Library function : They are redefined and precompiled that are designed
to perform for sum specific task. Information is passed to these functions
through arguments and returned through the returned statement. for ex
to calculate the square of a number and square root of a number power of
a number and length of a string etc.
Some of the library functions are print f, scan f , get character to upper()
to lower()
User defined function : They are those functions which programmer
writes on his own as per the requirements in the program .So functions
which are defined specifically by the user to meet his requirement are
called user define function. Every “C” program contains at least one
function that is main ( ) every function in “C” consist of following
components
(1) function definition
(2) function declaration or function prototype
(3) function call
4. An array is a finite ordered set of homogeneous
elements. Arrays is used to handle a large amount of
data without the need to declare many individual
variables separately. All the array elements must be
either of simple data types like integers float character
double character etc or they can be any user defined
data types like structure and unions
5. These are of three types
1. One dimensional arrays
2. Two dimensional arrays
3. Three or multi dimensional arrays
One dimensional array: An array with one dimension is referred
as one dimension array i.e. int a [ ]
Two dimensional array: An array with two dimensional is referred
as two dimensional array i.e. int a [ ] [ ]; two dimensional arrays
results in a matrix of rows and columns
Three or multi dimensional arrays: An array with more than two
dimensions is know as multidimensional array. An array may
consist of any number of dimension subjects to the restriction put
by a compiler depend upon the language i.e. int a [ 3 ] [ 4 ] [ 5 ]
6. A string is a group of character which can be store in a character array
many a time also called a string.
A string is a collection of character‟s terminated by a null character „0‟.
The null character indicates the end of the string.
Each character that compose a string is stored in one dimensional char
type array in contiguous memory locations for ex “Try Again” is a
collection of character‟s „T‟ „R‟ „Y‟ „A‟ „G‟ „A‟ „I‟ „N‟ and terminated by
a null character
STRING VARIABLE: It is an array of character's that has a defined
length. it can be used to store value
#include <stdio.h>
#include<conio.h>
7. Int strlen(s): This function takes one argument s
which can be a string constant or a string
variable. It returns the number of characters in
the string s excluding the NULL character
(„0‟). If string is empty, it return zero.
8. A pointer is a variable that contains the address
of another variable in memory. Suppose I is a
integer variable having value 10 stored at
address 2202 and address of I is assigned to
variable j, then j is a pointer variable pointing
to memory address stored in it. In other
words, j is a pointer variable containing
address of I (i.e.2002)
Pointer variable is also known as address
variable as it always store address of some
other variable.
9. Data-type*ptr-var-name;
Program demonstrate use of pointer variable and
address of operator
#include<stdio.h>
#include<conio.h>
main()
{int I,*ptr;
Clrscr();
i=5;
Ptr=&I;/*store address of i*/
Printf(“value of i+%d”,i);
Printf(“n address of i=%u”,$i);
Printf(“nvalue of ptr=%u”‟ptr);
Getch();