body, html { width: 100%; height: 100%; } body{ padding-top:100px; } body, h1, h2, h3, h4, h5, h6 { font-family: "Lato","Helvetica Neue",Helvetica,Arial,sans-serif; font-weight: 700; } #content{ min-height: 600px; } #banner_image { padding-bottom: 50px; text-align: center; color: #f8f8f8; background: url(../img/intro-bg_1.jpg) no-repeat center center; background-size: cover; } #banner_content { position: relative; padding-top: 6%; padding-bottom: 6%; margin-top: 12%; margin-bottom: 12%; background-color: rgba(0, 0, 0, 0.7); max-width: 660px; } #item_list { padding-top: 50px; } /*This code ensures that when we navigate to a particular section of a page, the section does not get lost behind the header*/ #cameras:before, #watches:before, #shirts:before{ display: block; content: " "; margin-top: -85px; height: 85px; visibility: hidden; } #login-panel .panel-footer{ font-weight:normal; } footer { padding: 10px 0; background-color: #101010; color:#9d9d9d; bottom: 0; width: 100%; } .red{ color:red; } #settings-container{ margin-bottom:10px; } .navbar-brand{ font-size:20px; } @media(max-width:768px) { #banner_content { padding-bottom: 15%; } footer{ text-align:left; } } .remove_item_link{ color:#0000ff; }

C- Functions

A large C program is divided into basic building blocks called C function. C function contains set of instructions enclosed by “{ }” which performs specific operation in a C program. Actually, Collection of these functions creates a C program.
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.
We can call functions any number of times in a program and from any place in a program.
A large C program can easily be tracked when it is divided into functions.
The core concept of C functions are, re-usability, dividing a big task into small pieces to achieve the functionality and to improve understandability of very large C programs.
There are 3 aspects in each C function. They are,
Function declaration or prototype – This informs compiler about the function name, function parameters and return value’s data type.
Function call – This calls the actual function
Function definition – This contains all the statements to be executed.
As you know, functions should be declared and defined before calling in a C program.
In the below program, function “square” is called from main function.
The value of “m” is passed as argument to the function “square”. This value is multiplied by itself in this function and multiplied value “p” is returned to main function from function “square”.
// function prototype, also called function declaration
float square ( float x );
// main function, program starts from here
int main( )
float m, n ;
printf ( "\nEnter some number for finding square \n");
scanf ( "%f", &m ) ;
// function call
n = square ( m ) ;
printf ( "\nSquare of the given number %f is %f",m,n );
float square ( float x ) // function definition
float p ;
p = x * x ;
return ( p ) ;

A function  in C is a group of sentences (basically commands) which altogether perform some task.
In fact all the operations performed in C are done by some function (either user defined or predefined ).
A function may take some inputs (i.e. passing parameters to function) and it may return a value after its execution (i.e. the return value).
A program should have at least one functions namely main() which marks the initiation of the execution of the program. We can define and call( this means to execute the function that we have already defined) user defined functions in C.

A file with definition of functions is called aLibrary. Including a library allows us to access(directly call) those function in our program. A library may also be predefined (like stdio.h allows us to use functions like printf and scanf) or a user defined library.
Post a Comment

Amazing Facts about Programming

Amazing Facts about programming  The first programmer was a lady named Ada Lovelac . She was a writer and gifted mathematician...

Popular Tutorials